How to get back fields from INSERT statement in batch mode(getGeneratedKeys

Hi,
I wanted to insert records to database and get back some fields.
I create prepared statement:
preparedStatement = connection.prepareStatement(sqlQuery, columnIndexes);
then I set parameters.
Following code works properly:
preparedStatement.executeUpdate();
generatedKeys = preparedStatement.getGeneratedKeys();
if (generatedKeys.next()) {
doSomething();
But when I try to do this by batch I get exception:
Caused by: java.lang.ArrayIndexOutOfBoundsException: 22
     at oracle.jdbc.driver.T4CNumberAccessor.unmarshalOneRow(T4CNumberAccessor.java:190)
     at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:612)
     at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
     at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:966)
     at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10644)
     at org.jetel.component.DBOutputTable.runInBatchMode(DBOutputTable.java:619)
My "batch" code:
for(...){
setParameters(preparedStatement);
preparedStatement.addBatch();
preparedStatement.executeBatch();
Isn't it a bug?
Can I get back fields (eg. from last insert added to batch)?
I hope somebody can help me.
Agata

This code works for me but only inserting one row. More than one causes an ArrayIndexOutOfBoundsException once sendBatch is called.

Similar Messages

  • How to get additional field from the second list base on lookup information column ?

    Hi everyone,
    Currently I created a SharePoint hosted Apps project and I need to know how can I get additional field from the second list base on lookup information column. example List1 Have 2 columns column1 and column2(Lookup Information from list2 (category)),
    List2 have 3 columns title, and category, and color.  so how can get the title and color from list2 base on this lookup information column (SharePoint Hosted apps and Javascript code)? that is possible?
    Best regards,
    ------------------------------------------------------------ ---Tola---

    You can build one custom lookup control. Refer to the following post
    http://www.stuartroberts.net/index.php/2012/10/03/enhanced-lookup-field-part-1/
    Alternatively, try the following solution from codeplex
    http://sp2010filteredlookup.codeplex.com/
    http://filteredlookup.codeplex.com/
    --Cheers

  • How to get Ethnicity field from IT 77 into BI

    We are in middle a new implementation of BI HCM and users want Ethnicity & Ethnic origin fields in BI. I can see Ethnic Origin as a attribute of Employee but can't find Ethnicity anywhere in standard BI content. What is the simplest way to get Ethnicity field from IT 77 (maintained by client) into BI.

    I would recommend enhancing the 0EMPLOYEE_ATTR DataSource by adding the Ethniticty column in an append structure of the extraction structure for that DataSource. Then to populate that field in the 0EMPLOYEE_ATTR DataSource, create a User Exit in CMOD (Function Module EXIT_SAPLRSAP_002).
    Then on BW, you're going to need to replicate the modified DataSource and in the 0EMPLOYEE InfioObject make sure you identify the attribute for Ethnicity as Navigational or Display. Then update the transformational processes to load into 0EMPLOYEE. Finally, you will need to add this custom InfoIObject to other InfoProvider(s) that you need it in (if any) to meet your end customer reporting requirements.
    Edited by: Dennis Scoville on Sep 10, 2009 8:33 PM

  • How to get private fields from super class?

    Hi.
    I must get protected and private fields from a class. I know that sounds werid but I have a very good reason for doing so, ask if you want.
    I have tried the getDeclaredField(String) method, but it apparently doesn't return the fields declared by the super classes.
    What's the smartest solution to this?
    Thank you all.
    edit: note that the superclass hierarchy's length is 3 and that there are several classes at the bottom level.
    Edited by: bestam on Sep 24, 2009 2:05 PM

    bestam wrote:
    I do not claim I have invented a new programming language Sir, you must be mistaken. This is not turing complete.
    This is a language for describing Cards or a game's rules if you want.
    AspectJ isn't Turing complete but AspectJ is still a compiler.
    This is how I have been working :
    - I have implemented the core library in Java (what is a Player, what is an Effect, what is a Card, what is a BuildingCard, what is a Player's Turn and so on)
    - It also includes packages dedicated to service, able to retrieve and send data to the clients via sockets.
    - Then I have "hardcoded" a dozen of specific cards in Java, for testing and validating the core library. I have been doing so by extending the BuildinCard's class for example.
    - But my ultimate goal is not to code thoses 1.000+ cards of the game in Java. I chosed to design a little language so that I would end up writing cards faster. While I'm traversing the syntactical tree representing the card, I feed the card's fields one by one. Some of them are quite primitive, some other are more complex and have a recursive nature for instance.
    Providing detail for how you implemented it doesn't change anything about what I already said.
    Thus, this is not really a compiler as it doesn't transform a text in language A into a text in language B.
    You really need to understand more about what "compilers" and certainly compiler theory do before you decide what they can and cannot do.
    And your statement still does not change what I said.
    Is this wrose than the bean design pattern from JSP ? I'm not sure.
    Bean design? A "bean" has almost zero requirements.
    Aside of that, it's a bit harsh to be told "read the fucking manual" while I have written my first compiler some years ago.Not sure who that was directed. I suggested some reading material on compiler theory.
    If you think that your idea is ideal then knock yourself out. Since I doubt I will end up seeing it in anything that I must maintain it doesn't matter to me. But you did in fact ask what the best solution was.

  • How to get Required field from R/3 to  load in Bw.

    To get a perticular value from R/3 to BW . in r/3 side I need to go to first table equi from there i pick equipmentno on the basis of this number i need to go to objnr from objnr i need to pick up objnr number and i have to see this number's value in table AUSP. like this same scenario i am facing in master as well as transaction tables , how i should fetch these values and load to BW .
    In standard datasources if i want to add the field value of which is derived by the value in two more tables then how do i Enhance the datasource.
    Can any one give clue to resolve It.

    Hi Srinivas,
       If you want to enhance any data source, by appending any field from any table.. basic rules are
    1. All the key fields in that perticular table should be available in your data source.
    2. Similar for more fields from different tables.
       Or if you want to extract more fields from different tables try to create a View on these table and go for generic extraction(create data source on this View). Choose which one if best option for your requirement.
    Hope it Helps
    Srini

  • Lost all data. How to get back information from iCloud.

    Hello everyone! My iPhone updated itself and deleted all my messages, mailbox, what's app. I guess it happened because I had got a new iOS7  before. How can I get back all information using iCloud? Would be great if you help to find a solution! Thank you!

    Did you try ...
    Settings - iCloud - login to your account ?
    by default it should get back all your info saved there.

  • Question reg. how to get a field from a table

    What is EIN? (I think it is employer identification number). My functional consultant told me to get this value from company code. Can you tell me from which table and field I can get this value?
    Thanks,
    Krishen

    i think these tables are helpfull
    /SAPPCE/TDPC01
    /BEV1/RBVBAK
    /BEV1/RBVBAP
    VSVBAK_CN
    VSVBAp_CN
    VBAK and VBAP.
    Regards,
    Pradhan.

  • TS3992 how can get back pictures from icloud

    Hi Every One.. I have ipad mini & already backup the file (pictures) into icloud an about 2.7gig file.. How can i get back/transfer all the file in icloud to my new ipad retina..please help me

    http://support.apple.com/kb/PH12521?viewlocale=en_US&locale=en_US

  • How to get jhelp field from DefaultHelpBroker

    Since java help 2.0 most of protected fields such as frame and jhelp got disappeared.
    About frame field, I can get this field using "getWindowPresentation().getHelpWindow() method.
    But I can't find any method to get "jhelp" field which was a protected field in earlier version.
    Anyone knows?
    Thanks ahead.

    I would recommend enhancing the 0EMPLOYEE_ATTR DataSource by adding the Ethniticty column in an append structure of the extraction structure for that DataSource. Then to populate that field in the 0EMPLOYEE_ATTR DataSource, create a User Exit in CMOD (Function Module EXIT_SAPLRSAP_002).
    Then on BW, you're going to need to replicate the modified DataSource and in the 0EMPLOYEE InfioObject make sure you identify the attribute for Ethnicity as Navigational or Display. Then update the transformational processes to load into 0EMPLOYEE. Finally, you will need to add this custom InfoIObject to other InfoProvider(s) that you need it in (if any) to meet your end customer reporting requirements.
    Edited by: Dennis Scoville on Sep 10, 2009 8:33 PM

  • How to get a field from an attached excel/csv?

    I currently manage some price lists for the company I work for. They are graphical, and usually created in inDesign and then exported to pdf.
    I'm looking for a way to attach our company's prices in an excel sheet, (or delimited file) and be able to pull a price into the pdf.
    For example, attaching an excel file with 2 columns, SKU & Price. Then saying, if text field SKU= "APPLE" text field PRICE = "0.50". Only I don't want the user to have any inpurt options, I want to do this myself and then save a flat version to distribute in the company.
    I've been working on this for a few weeks. My javascript skills are really rough.
    So far, I have some code in my pdf that looks like this:
    (Price.csv is an attachment in the PDF)
    var oFile = this.getDataObjectContents("Price.csv");
    var sData = util.stringFromStream(oFile, "utf-8");
    function ParseData(sData){
    var oData = {};
    sData.replace(
    new RegExp( "\\[(\\w+)=([^\\]]*)\\]", "gi" ),
    function( $0, $1, $2 ){
    oData[ $1 ] = $2;
    return( oData );
    // Parse the data into an object
    var oData = ParseData(sData);
    // Custom Calculate script for price text field
    (function () {
        // Get the value of the SKU field
        var sku = getField("SKU").valueAsString;
        // Look up the price
        var price = oData[sku];
        // Set the value of this field to the price if it's present,
        // otherwise blank this field
        event.value = price || "";
        console.println(price);
    I have two text fields on the form. One that I have filled in a valid SKU, and a blank one named event.
    I seem to be getting an undefined error on prices. I am completely lost as to where to go from here.
    Does anyone have an idea of where I may be going wrong? I get that undefined error and nothing appears on my form.
    Thank you in advance.
    (I have acrobat X pro)

    First of all, "undefined" is not an error. It just says that the script ended without returning any values.
    I would suggest starting by debugging the code that reads the input file (you have to use a plain-text file, by the way, not an Excel spreadsheet). Make sure that oData actually contains the data you expect it to contain. If that works OK, start debugging your calculation script and see what's going on there...

  • How to get back videos from iPhone

    Hi,
    I have many videos on my old iPhone under iPod application.
    How can I upload them onto my computer and then on my new iPhone without Backup/Restore because Apple recommended to not restore the new iPhone from the last backup.
    Thanks!

    The songs I'm trying to reload on my phone are on my PC.  These we had loaded into iTunes.  I can remove them all from the library and then add them all back one by one I imagine.  The problem I'm having is that I removed them manually from the phone, they still appear in iTunes music library yet they won't sync.  I don't want to take the time to compare the phone to my library, remove from the library what's missing on the phone and then add them all back again.  64GB (mostly music) will take a while.

  • How to get invoice field from SD tables

    Hi, experts,
    what is the "invoice field name" in SD tables.
    please specify in which tables i can find it

    Hi Praveen,
    in SD the order,delivery or invoice , evrything has field name vbeln.
    only difference is which table your are referreing.
    if you are working on VBAk, the vbeln will give the sales order..
    if in LIPs, it will give delivery while in VBRK for vbeln you will get invoice number.
    VBFA will give you the complete flow of order, delivery and invoice
    e.g:-
    Find sales order number and item from the delivery document
    number and delivery item no by using sales document flow table
        select single VBELV POSNV from VBFA into ITAB where
               VBELN = mseg~oivbeln and         "delievry
               POSNN = mseg~oiposnr,     and  "Delivery item
               VBTYP_N = 'J'.

  • How can I create back up dvds for itunes and how do I back up from existing dvds?

    How can I create back up dvds for itunes and how do I back up from existing dvds?

    Recovery Mode:
    1. Turn off iPad
    2. Connect USB cable to computer; leave the other end alone
    3. Press and hold the Home button down and connect the docking end of cable to iPad
    4. Continue holding the Home button until you see the "Connect To iTune" screen
    5. Release the Home button
    6. Open iTune
    7. You should see "iTunes has detected an iPad in recovery mode"
    8. Use iTune to restore iPad
    Note: You need to be patient and repeat the above many times to recover your iPad

  • How to retrieve value from insert statement

    hi,
    how can i get a certain value from insert statement and store it in a variable.
    suppose i am inserting emp_no , emp_name , emp_salary to employee table
    and i want to store the emp_name in a variable for other processing,
    how can i accomplish this ? i'm guessing that i have to use trigger,
    but dont know the procedure .
    any help will be greatly appreciated
    thanks

    insert into <table> valiues (....) returning <expression> into <variable>
    You could and should have found this using the SQL Language reference manual
    or
    http://www.morganslibrary.org/reference/insert.html
    Sybrand Bakker
    Senior Oracle DBA

  • How to get the data from mysql database which is being accessed by a PHP application and process the data locally in adobe air application and finally commit the changes back in to mysql database through the PHP application.

    How to get the data from mysql database which is being accessed by a PHP application and process the data locally in adobe air application and finally commit the changes back in to mysql database through the PHP application.

    If the data is on a remote server (for example, PHP running on a web server, talking to a MySQL server) then you do this in an AIR application the same way you would do it with any Flex application (or ajax application, if you're building your AIR app in HTML/JS).
    That's a broad answer, but in fact there are lots of ways to communicate between Flex and PHP. The most common and best in most cases is to use AMFPHP (http://amfphp.org/) or the new ZEND AMF support in the Zend Framework.
    This page is a good starting point for learning about Flex and PHP communication:
    http://www.adobe.com/devnet/flex/flex_php.html
    Also, in Flash Builder 4 they've added a lot of remote-data-connection functionality, including a lot that's designed for PHP. Take a look at the Flash Builder 4 public beta for more on that: http://labs.adobe.com/technologies/flashbuilder4/

Maybe you are looking for

  • Problem with JSlider

    I have a JSlider whose minimum value can be -50 and maximum value +50. Why function setValue(int n) doesn't work? Advance thanks! Best Regards!

  • How to download document on ipad2 ?

    How one can download an attachment received to ipad 2 from gmai?

  • Recording File Size issue CS 5.5

    I am using CS 5.5, a Balckmagic Ultra Studio Pro through USB 3.0 being fed by a Roland HD Video switcher. Everything is set for 720P 60fps (59.94) and the Black Magic is using the Motion JPEG compression. I am trying to record our sermons live onto a

  • Check spelling of concatenated words

    Hello, I'm doing a puzzle construction spreadsheet where I've concatenated individual letters to make words. I don't have all the letters for each word in the correct order, so I figured I could correct them through the Spell-checking program. It won

  • Bc set template issue

    Hi, I am trying to copy one BC set which is purely for fi. It is giving dumpfor incomplete parameter in table t169p. This table is for invoice verification which is not releavant to our template. Also  there is no version change in orginal server and