aspose file tools*
The moose likes JDBC and the fly likes DB2 ZOS DB2 SQL error: SQLCODE: -181, SQLSTATE: 22007, SQLERRMC: null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "DB2 ZOS DB2 SQL error: SQLCODE: -181, SQLSTATE: 22007, SQLERRMC: null" Watch "DB2 ZOS DB2 SQL error: SQLCODE: -181, SQLSTATE: 22007, SQLERRMC: null" New topic
Author

DB2 ZOS DB2 SQL error: SQLCODE: -181, SQLSTATE: 22007, SQLERRMC: null

Anshul Choudhary
Greenhorn

Joined: Oct 31, 2010
Posts: 1
Hello all

I have a pretty muddling problem at hand.

I am trying to insert a row into table which contains a field LAST_UPDATE_TIME. I set this to the current time using java.sql.date and then run my Insert statement.

But I keep getting this error in my logs: Error while adding ComSubQuestion : Sql Exception: com.ibm.db2.jcc.b.SqlException: DB2 SQL error: SQLCODE: -181, SQLSTATE: 22007, SQLERRMC: null

I am using DB2 ZOS and JNDI conncetivity.

Below is the query:
INSERT INTO COM_SUB_QUESTION (OWNER_ID,CLIENT_ID,INITIATIVE_ID,TASK_ID,QUESTION_NO,ROW_NUMBER,QUESTION_TEXT,QUESTION_ID,LAST_UPDATE_TIME,LAST_USER) VALUES (?,?,?,?,?,?,?,?,?,?)

I set the current time in my object by the following code:

currentSubQuestion.setLastUpdateTime(new java.sql.Date());

and then later in some other piece of code use this object to insert time for the new record by the following code.

dQ = new dbConn.prepareStatement(sqlStmt);
int LAST_UPDATE_TIME_POSITION = 9;
java.sql.Date currDate=new java.sql.Date(currentComSubQuestion.getLastUpdateTime().getTime());
dQ.setDate(LAST_UPDATE_TIME_POSITION, currDate);

The DB2 Driver I am using is: DB21085I Instance "db2inst1" uses "64" bits and DB2 code release "SQL09013"
with level identifier "01040107".
Informational tokens are "DB2 v9.1.0.3", "s070719", "MI00203", and Fix Pack
"3".

When I run this piece of code in the following DB version: Version:- "DB2 v8.1.9.710", "s050502", "WR21351", and FixPak "9"
Driver :- db2jcc.jar
Driver Class :- com.ibm.db2.jcc.DB2Driver

it works perfectly fine.

I am not a pro in this and hence really need some help from the bigger brains.

Any suggestion/comments are most welcome.

Thanks
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: DB2 ZOS DB2 SQL error: SQLCODE: -181, SQLSTATE: 22007, SQLERRMC: null