Batchupdate fails in DB2/400

Hi
I�m trying to do a batchupdate in an DB2/400 table but when I try to insert I get an error that there�s a duplicate key value and the update fails. This is normal behavior as indeed the program should only add a record if it doesn�t exist yet, if it does, it should move to the next record. I use this code:

String cmd= "INSERT INTO TABLE1(IBY58IAWB)VALUES (?)";
AS400stat = AS400Conn.prepareStatement(cmd);
     while (rs.next())
     AS400stat.setString(1,rs.getString(1));
     AS400stat.addBatch();
     int[] updateCount=AS400stat.executeBatch();
     AS400stat.clearBatch();

catch (BatchUpdateException b)
     System.out.println("error: " + b.getErrorCode());
     For(int x=0;x<b.getUpdateCounts();x++)
System.out.println(getUpdateCounts[x]);
     return;     
the problem is that the errorcode returned is 0 and getUpdateCounts returns no elements, so the program stops executing.
I�m using the IBM ODBC-JDBC bridge, which supports batchupdates. I know some drivers continue executing the batch even when an error occurs, obviously this one doesn't
Thanks for your help!

Surely you should just use executeUpdate(), catch and ignore the duplicate key exception.
As far as I can remember, the JTOpen driver(http://www-124.ibm.com/developerworks/oss/jt400/) behaves the same.

Similar Messages

  • How to track modification of PK for JKM DB2/400 Journal Simple

    Hi gurus,
    Updating Primary key cannot propagate to target table using cdc with JKM DB2/400 Journal Simple.I find a tuple of new primary inserts into target table without deleting the old one.Is there any customized SAVPGM**** for PK modification in DB2/400?
    CDCRTVJRN: SAVPGM0106,SAVPGM0107
    Thanks,
    nan

    Thanks to all for assistance. It turns out that the 10 character limit, about which the server people warned me, isn't an issue with my ODBC connection. The invalid token error was being caused by some missing qualifiers in the generated sql which caused appearances of ".tablename" rather than "tablename" and other similar. I was able to modify the knowledge module to eliminate this issue and the CDC worked correctly on my first test.

  • JKM DB2 400 column and table name 10 character limit

    I am trying to set up CDC on an iSeries. I have successfully loaded data with the LKM SQL to Oracle, and now I want to set up CDC for the table and am trying to use "JKM DB2 400" . I get invalid token errors when I try to start journalizing, and it appears to be the table and column names, used to set up CDC, which are more than the 10 character limit. Tables like SNP_JRN_SUBSCRIBER seem to come from the getJrnInfo function and other table and column names are hard coded. I want to copy the JKM and reduce all of the names to less than 10 characters.
    Where else are these names used? How does the interface know which table names to use when set to use only journalized data and how can I change it to use the new shorter names? Is there a better solution?

    Thanks to all for assistance. It turns out that the 10 character limit, about which the server people warned me, isn't an issue with my ODBC connection. The invalid token error was being caused by some missing qualifiers in the generated sql which caused appearances of ".tablename" rather than "tablename" and other similar. I was able to modify the knowledge module to eliminate this issue and the CDC worked correctly on my first test.

  • Migrate from db2/400 (V5R2) to Oracle

    Greetings!
    We are looking at helping a customer migrate their DB2/400 (V5R2M0) database to Oracle (planned for 10gR2).
    I see there is a Migration Workbench offering for the lower revisions (v4r3) as well as for DB2/UDB, however nothing for V5R2M0.
    There are over 1500 files (tables) to convert so we don't want to have to do a dump & load.
    Any suggestions?
    Thanks!!
    Jim Kotan
    Senior Data Management Architect
    MSI System Integrators
    http://www.msiinet.com
    402-965-2556
    Message was edited by:
    Jim Kotan

    Jim,
    I work for a group in Oracle Server Technologies that focuses on legacy (mainframe and midrange) modernization. There are three options from Oracle:
    1. Oracle Data Integrator (was Sunopsis) - This product is completely written in Java so it can even run on the iSeries/AS400. http://www.oracle.com/technology/products/oracle-data-integrator/index.html
    2. Oracle ransparent Gateway for DB2/400 - Can execute qeuries directly against DB2 to migration the data. http://www.oracle.com/technology/products/gateways/tg4db2400.htm
    3. OWB (Oracle Warehouse Builder) - This is an ETL offering from Oracle. Two options for moving the data FTP (and load the flat files) or if you have an ODBC driver on the iSeries can use this with OWB. http://www.oracle.com/technology/products/warehouse/index.html
    Hope this helps. My team is hear to help with legacy modernizations so don't hestitate to contact me at [email protected]
    Tom

  • Date Migration from IBM DB2/400 V4R3M0 to Oracle 11.2G

    Dear ALL<
    We have a requirement for Date Migration from IBM DB2/400 V4R3M0 to Oracle 11.2g. Can you guys please share your experiences with similar activities done in the past ? We do not have environment at present to try out with Oracle Migration workbench.
    http://www.oracle.com/technetwork/topics/index-095746.html
    You experiece sharing will really help ...!!
    Regards,
    VKMP
    Edited by: 909016 on Jan 31, 2013 5:52 AM

    Hi VKMP,
    As well as reading the documentation thoroughly the following note available in My Oracle Support may be useful -
    Problem To Migrate Table With Table Type P From DB/AS400 With OMWB (Doc ID 466271.1)
    as OMWB does not support migrating physical files.
    Regards,
    Mike

  • Is HS Generic Connectivity(db2/400 odbc) supports Distributed Transaction?

    hi,
    Is HS Generic Connectivity(db2/400 odbc) supports Distributed Transaction?
    I am getting an error as follows
    "ORA-02047 cannot join the distributed transaction in progress" when i am trying a transaction, which is inserting in to db2/400 and updating in Oracle.
    if it does not support this, what is the best way
    to do such things using generic connectivity.
    (eg. by committing each sql statement ?)
    my db is oracle 9i 9.2.0.4.0
    remote db is db2/400 connected with client access ODBC.
    Thanks
    BA

    Hi,
    one of the restrictions of generic connectivity is, that distributed transactions are not allowed.
    See manual: 7-6 Oracle9 i Heterogeneous Connectivity Administrator's Guide
    - Generic Connectivity agents cannot participate in distributed transactions; they
    support single-site transactions only
    So you can only commit after each statement or you have to use the GATEWAY

  • How to lock a row in a db2/400

    Hi all,
    Could someone show me how to lock a row in the database DB2/400
    The scenario:
    DB.beginTransaction
    User 1 gets a row with a column bill_number
    "select bill_number from numbers where pk = xxx for update"
    aux_bill_number = bill_number
    USER 1 updated this row
    "update numbers set bill_number = bill_number +1 where pk = xxx "
    USER 1, like final step, insert aux_bill_number in other table as primary key
    DB.commitTransaction
    While doing so,
    User 2 also gets a row with a bill_number. this user must take bill_number with value 2, but take the same value 1
    This it causes key duplicated in the destiny table.
    Please, help me.
    How I must lock the row not to allow to read until finishing the previous transaction?

    Hi all,
    Could someone show me how to lock a row in the
    database DB2/400Isn't SELECT FOR UPDATE standard?
    >
    The scenario:
    DB.beginTransaction
    er 1 gets a row with a column bill_number
    "select bill_number from numbers where pk =
    xxx for update"
    aux_bill_number = bill_number
    1 updated this row
    "update numbers set bill_number = bill_number
    +1 where pk = xxx "
    USER 1, like final step, insert aux_bill_number in
    other table as primary key
    DB.commitTransactionSounds like you're trying to do something that a JOIN would do better.
    While doing so,
    User 2 also gets a row with a bill_number. this user
    must take bill_number with value 2, but take the
    same value 1
    This it causes key duplicated in the destiny table.
    Please, help me.
    How I must lock the row not to allow to read until
    finishing the previous transaction?Setting the isolation level to SERIALIZABLE might help.
    %

  • CCMS monitoring for DB2/400 database backup.

    Hi,
    sap on iseries experts,
    We need a good monitoring for the alerts from DB2/400 database backup failure with CCMS for a solution manager management.
    Actually I don,t see a specific node (or MTE class) inside CCMS for this alert;
    But DB12 display well the daily backup status . . . . . . . .
    Can anybody help me ?
    Kind Regards
    Fabio

    Hi all,
    I'm searching also for such an possibilty.
    When running Oracle there is following MTE:
    RZ20 -> SAP CCMS Technical Expert Monitors -> All Monitoring Contexts -> Oracle -> Backup/restore -> Backup status -> Last succ
    Does anybody know a method to monitor the backup with SAP on Iseries?
    Tobias

  • DB2/400 Gateway for iSeries - Where to Download

    Does anyone know how to obtain DB2/400 Gateway for iSeries IBM?

    http://www.oracle.com/technology/software/products/database/oracle10g/index.html
    select platform and after that you'll be able to see and select gateways.

  • Error when running SQL over DB2/400 database

    Folks,
    I'm trying to execute an SQL statement which works well on DB2/400 but doesn't like it in Java embedded SQL.
    The statement looks like this...
    select rrn(a) from BLMINTF1 a where RDTUSC = 050106 or RDTADC = 050106 or RDTBPC = 050106 or RDTCDC = 050106 or RDTE1C = 050106
    and the error I get is as follows...
    java.sql.SQLException: An undefined column name was detected.
    java/lang/Throwable.<init>(Ljava/lang/String;)V+4 (Throwable.java:94)
    java/lang/Exception.<init>(Ljava/lang/String;)V+1 (Exception.java:42)
    java/sql/SQLException.<init>(Ljava/lang/String;Ljava/lang/String;I)V+1 (SQLException.java:43)
    com/ibm/as400/access/JDError.throwSQLException(Ljava/lang/String;)V+0 (JDError.java:394)
    com/ibm/as400/access/JDServerRow.findField(Ljava/lang/String;)I+0 (JDServerRow.java:313)
    com/ibm/as400/access/AS400JDBCResultSet.findColumn(Ljava/lang/String;)I+0 (AS400JDBCResultSet.java:552)
    com/ibm/as400/access/AS400JDBCResultSet.getString(Ljava/lang/String;)Ljava/lang/String;+0 (AS400JDBCResultSet.java:31
    gmi/pme/ReadIntRateXML.updatetable(Ljava/lang/String;I)V+0 (ReadIntRateXML.java:135)
    gmi/pme/ReadIntRateXML.main(^Ljava/lang/String;)V+0 (ReadIntRateXML.java:45)
    Any help will be greatly appreciated.
    Thanks in advance.

    (Oops, ignore the above, a missing /code tag ate most of my post)
    So does this work:
    select 42 from BLMINTF1 a where RDTUSC = 050106 or RDTADC = 050106 or RDTBPC = 050106 or RDTCDC = 050106 or RDTE1C = 050106
    There is a chance that the driver for some odd reason doesn't understand a particular SQL function. That's less likely than a simple typo though. Usually JDBC drivers don't care about the SQL they execute, they just pass it to the server. Command line SQL tools may have extra commands, but rarely functions like that.
    I'd still print out the SQL string just before execution. I've seen things like this often enough:
        String s =
            "select x from foo" +
            "where x = 1";Note the lack of space between "foo" and "where", resulting in "foowhere".

  • D4ODBC to Iseries DB2 400, not resolving @ and #

    I have a Oracle Linux 64 bit server running Oracle 11.2 (AL32UTF8).  I have Oracle database gateway for ODBC installed along with UNIXODBC 2.3 with iseries for linux odbc driver.  I am connecting to an AS/400 system that is running DB2 400 using a database link.  The AS/400 is using CCSID=65535.  Everything is working well except there are a few symbols that the Oracle is not resolving.  What appears on the AS/400 as @ appears as Ö in the oracle view on the AS/400 table.  What appears as a # on the AS/400 appears as a Ä on the oracle view of the AS/400 table.  Any guidance would be greatly appreciated.
    This is what my gateway ini file looks like:
    HS_FDS_CONNECT_INFO = usmas1
    HS_FDS_TRACE_LEVEL = off
    HS_FDS_SHAREABLE_NAME = /usr/lib64/libodbc.so.1
    HS_NLS_NCHAR = UCS2
    HS_LANGUAGE=american_america.WE8EBCDIC37
    HS_RPC_FETCH_REBLOCKING=OFF
    #HS_FDS_FETCH_ROWS=1
    HS_FDS_SQLLEN_INTERPRETATION=64
    # ODBC specific environment variables
    set ODBCINI=/etc/unixODBC/odbc.ini
    # Environment variables required for the non-Oracle system
    #set <envvar>=<value>
    set DB2CODEPAGE=37

    Hi,
    According to your description, my understanding is that you want to create a data source connection to iSeries database in SharePoint Designer.
    I recommend to link the iSeries DB2 database to the SQL and then create one or more views to the linked server on a SQL database.
    After that, create the data connection to the database where we used to create the views to the linked server to see if the issue can be fixed.
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • Oracle WebLogic Server - How to connect to IBM DB2-400

    Hi to all,
    I'm afraid I'm going to ask a f.a.q... anyway... I'm trying to define a Connection Pool to Db2/400. I see that Oracle App Server do support DB2 on windows and linux O.S;
    what about DB2 on a iSeries / iOs machine ?
    Thank you in advance for your help.

    1. Can OSB connect to JMS Queue which resides within the IBM Maximo Application? If yes can you please provide any documents/link which outlines the steps.Yes. You can use a OSB proxy service with jms transport to dequeue the messages from remote weblogic jms.
    2. Do I need to configure a Messaging Bridge or a Foreign JNDI provider in Weblogic? Which is the best optionNot required.
    3. What information do we need to configure in Weblogic to connect to the JMS Queue in IBM Maximo Application? Configure a proxy service with jms transport. Here you have to provide the transport URI hostname/port part you have to give details of the maximo WLS server host and part.Since jms transport involves rmi communication between two weblogic domains, you also need to setup either global trust between the domains or cross domain security.
    http://download.oracle.com/docs/cd/E12839_01/web.1111/e13707/domain.htm#i1176046

  • IBM Client Access ODBC Driver DB2/400 SQL7017 Unable to run statement with specified commit level #-7017

    Changed IBM As/400 system from V4R5 to V5R2 and now get this message when using Access to link to external database the same exact settings on everything I can determine on all computers. 
    IBM Client Access ODBC Driver DB2/400 SQL7017 Unable to run statement with specified commit level #-7017
    I have Commit immediate = *NONE in the Advanced Server Options in ODBC Data Source Administrator. It shows the AS/400 files in the Link Tables list and allows me to add it to the Access table objects, but when I try to open it in datasheet view I get that
    error.
    What am I missing?

    Ouch. That's a lot of paste...
    INFO: PATH = C:\oracle\product\10.2.0\client_2;C:\oracle\product\10.2.0
    \client_1;T:\SDCHS20N440\Oracle\agent10g\jlib;T:\SDCHS20N440
    \Oracle\agent10g\bin
    INFO: The flags set for this home (T:\SDCHS20N440\Oracle\agent10g) are:clean
    SEVERE: Abnormal program termination. An internal error has occured. Please
    provide the following files to Oracle Support : I wonder how "T:" is involved. Looks like you got a management agent on a network drive. If so, is this Home registered with the oraInventory on your machine? Can you try the same install on a machine without any previous Oracle software installed?

  • Is DB2/400 support for Hyperion Intelligence?

    Has anyone tested connecting DB2/400 via Hyperion Intelliigence?
    Some of my sales representatives are in a rush.
    Regards.

    It should work fine. You would just need to install the IBM iSeries Access ODBC drivers on the machine where you are using Hyperion Intelligence.

  • Database connection to DB2/400

    We have a need to connect to DB2 running on an AS/400. I have created the database connection in JDev902 and queries using the the SQL Window work great. When I try and use this connection in a BC4J project, I get a No Driver Found error. I have double checked the data source and it appears to be correct. Does anyone know if connecting to an AS/400 works? The doc indicates that JDev will only 'talk' to DB2 running on NT.

    John:
    The doc indicates that JDev will only 'talk' to DB2
    running on NT.We have certified/tested BC4J against Universal DB2 running on NT. While we have not tried it against DB2/400, if you use Universal DB2, it should work.
    'No Driver Found' seems to indicate that the DB2 JDBC driver is missing. Have you had a chance to look at
    http://otn.oracle.com/products/jdev/howtos/bc4j/bc_foreign_db_intro.html
    Thanks.
    Sung

Maybe you are looking for

  • Does the mini DVI port cary audio if using a Mini-DVI to HDMI Adapter?

    Hello everyone, I've heard it is possible for a DVI port to transmit audio data to a HDMI connection if a DVI to HDMI cable is used, which will allow the sending of both audio and video to your TV. see: http://en.wikipedia.org/wiki/DigitalVisualInter

  • Looking for a powerful app for itunes

    I read about that app on usingmac.com as an ad. It is so powerful that can search the tracks info even if the music is imported from a CD and all tag turns to "unkown". It can search CD cover as well. I guess it has both PC and Mac ver, yet not free.

  • 10g installation error on RHEL4

    Hi all I am installing 10g 10.2.01 on RHEL 4 I got error [oracle@vtopup oracle10g]$ ./runInstaller Starting Oracle Universal Installer... Checking installer requirements... Checking operating system version: must be redhat-3, SuSE-9, redhat-4, United

  • Iphone3g without apps, since all of them are for ios 5 now...

    Is there any way to download OLD apps versions? cause all the ones i download are not compatible with the 3g. I have an empy 3g ihpone....

  • Keywords are not showing up on photos

    After going to great length to assign keywords to my entire photo library, I burned all the photos onto iPhoto DVDs in preparation for my computer getting a new hard drive installed. After new hard drive was installed, I reinstalled iPhoto 4.0.3 and