By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,334 Members | 1,328 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,334 IT Pros & Developers. It's quick & easy.

Autoincrement DB2 JBOSS EJB CMP

P: n/a
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!!!

how to configure Jboss ?

Please Help!!!

thanks



Mar 2 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
you are specifying value for column which is supposed to be auto
generated
that is the cause of error you are getting
here is the explanation from db2
================================================== =======
SQL0798N A value cannot be specified for column
"<column-name>" which is defined as GENERATED ALWAYS.

Explanation:

When inserting or updating a row in a table, a value was
specified for the GENERATED ALWAYS column "<column-name>".
GENERATED ALWAYS columns should not be specified in the
column-list for an INSERT or in the SET clause for an update
unless the keyword DEFAULT is specified.

The INSERT or UPDATE is not performed.

User Response:

Remove the GENERATED ALWAYS column from the column-list or SET
clause, or specify DEFAULT as the column value.

sqlcode : -798

sqlstate : 428C9
================================================== ==================

On Mar 2, 5:09 am, "Grzes_P" <grzesi...@wp.plwrote:
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!!!

how to configure Jboss ?

Please Help!!!

thanks

Mar 2 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.