1 Reply Latest reply on Mar 26, 2007 4:13 PM by Paul Risenhoover

    Autoincrement DB2 JBOSS EJB CMP configuring

    Andrzej Janek Newbie

      Hi!

      J have database DB2 and create table T_TEST with fields:
      ID - integer autoincrement
      NAME - varchar(50)
      QTY - Integer

      I create java bean CMP and install it on Jboss server and when create new
      record from client I get error:

      com.ibm.db2.jcc.c.SqlException: DB2 SQL error: SQLCODE: -798, SQLSTATE:
      428C9, SQLERRMC: ID

      I get the same error when execute command:
      Insert into T_test (id,name,qty ) values (10,'OK',12)

      and when execute :
      Insert into T_test (name,qty ) values ('OK',12)
      ... all is OK!!!

      this problem is in autoincrement configuration in Jboss.

      how to configure Jboss ?

      Please Help!!!

      thanks

        • 1. Re: Autoincrement DB2 JBOSS EJB CMP configuring
          Paul Risenhoover Newbie

          Hi there,

          I don't know if I can answer your question exactly, but I can assure you that I've been using DB2 for about two years now, with hand-written JDBC code to do my inserts into tables with AUTO-INCREMENT, and I get DuplicateKeyExceptions all the frickin time.

          I've actually had to hand-write exception handlers to catch any exceptions during inserts, check the cause, and if it's because of a duplicate key exception, perform a manual increment and re-insert the row.

          I'm using DB2 v 8.