Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

IBM DB2 - Prepared Statement problem with '? is NULL'

843854Jul 11 2005 — edited Jul 11 2005
Hi,

I just started to use DB2 and I wanted to move some SQL statements that I was using in Oracle (and tested in MySQL).

SELECT t.id FROM table t WHERE
((? is NULL) OR (t.id=?))

Prepared statement:
ps.setString(1, (String)null);

It looks like '? is NULL' doesn't work with DB2, does anyone had this problem before and do you know how this can be fixed?

I'm getting this error SQLCODE: -418, SQLSTATE: 42610, SQLERRMC: null. and my driver is com.ibm.db2.jcc.DB2Driver (db2jcc.jar)

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 8 2005
Added on Jul 11 2005
4 comments
346 views