| Author |
How does PreparedStatement.setObject() API behaves with null value?
|
Rashmi Tambe
Ranch Hand
Joined: Aug 07, 2001
Posts: 418
|
|
How does PreparedStatement.setObject() API behaves with null value? For e.g. If i have would the null passed in setObject is tranlated as SQL data type Null always? or do i have to use setNull() API? JDBC 3.0 spec says that,
(section 13.2.2) a value must be provided (setXXX()). if the value is not set, then a SQLException should be thrown.
Is this enforced in JDBC 2.0 also? I could not get documentation abt this for JDBC 2.0...so i am doubtful. when i run this code, it works fine sometimes. however, sometimes i get, java.sql.SQLException: ORA-01475: must reparse cursor to change bind variable datatype this behavior is random. so i am doubtful abt the behavior of setObject() Can anybody exaplin this?
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26192
|
|
Rashmi, JDBC doesn't support setting nulls this way. dbforums has a post on this. Some drivers may support it, but it's not universal.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
 |
|
|
subject: How does PreparedStatement.setObject() API behaves with null value?
|
|
|