How to quickly locate problems in error reporting of db2-407 sqlcode: – 407, sqlstate: 23502

Why can’t you grab tickets when you travel on holiday?Reveal the key technology of 12306 how to ensure the ticket is not oversold>>>

Sqlcode: – 407, sqlstate: 23502: the exact description of this error report is that the null value cannot be inserted into the column defined as not null. That is, the integrity constraint exception is violated
in development, we often encounter this error. The problem is also very simple, that is, “the column that cannot be empty is empty.”. For a table with many fields, it is difficult to check. How to accurately
locate?It’s very simple

We can learn more details from the error information, which can help us accurately locate the problem. The general error information is as follows: xception:DB2SQLerror :SQLCODE:-407,SQLSTATE:23502,SQLERRMC:TBSPACEID=2,TABLEID=201,COLNO=3 java:1396 ) java:356 ) java:64 ) java:48 ) java:312 ) java:1723 ) java:2315 ) java:1326 ) java:1310 )

atjava.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor. java:886 )

atjava.util.concurrent.ThreadPoolExecutor$ java:908 ) java:662 )

Message: integrity constraint exception(

—The error occurred in D: \ — path omitted ——–





Carefully observe this error message: sqlcode: – 407, sqlstate: 23502, sqlerrmc: tbspaceid = 2, tableid = 201, colno = 3. It can be found that this error message has been positioned clearly. We just need to go to the system table syscat. Columns to query. The syscat.columns table is the system table, which holds the column details of all tables in the DB2 database. We only need to find which column is according to
view, table name and column number. Colno = 3 in the above error information is the column number of the error. As follows:

COLNO = ‘3’

Similar Posts: