| Author |
Help regarding insertion in the database
|
Aditya Vasudeva
Ranch Hand
Joined: May 27, 2008
Posts: 76
|
|
I am using DB2 as my database manager. The problem I am facing is that I cannot insert data into multiple tables at the same time. The code is given below: The data gets inserted into the first table but doesnt get inserted into the 2nd one. It throws an SQLException saying that there is NULL value. Please help...!! Waiting for a reply......
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32833
|
|
|
You ought to believe the Exception; you are obviously passing null to a NOT NULL column.
|
 |
Aditya Vasudeva
Ranch Hand
Joined: May 27, 2008
Posts: 76
|
|
the problem is that i have tried inserting data into both the tables seperately. The insertion works fine when inserting into each table seperately!! It doesnt work when inserting into both tables one after the other. What do i do now??? Please help !!
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32833
|
|
Are you passing the data in the correct format? If there is any checking for formats (with CHECK CONSTRAINTs or similar) that might convert the data to null. You appear to have a severely denormalised table, with columns like e-mail which don't depend directly on the primary key. Don't know whether that affects it. Have you tried passing that String from the command line? Sorry, can't think of any more suggestions.
|
 |
 |
|
|
subject: Help regarding insertion in the database
|
|
|