Skip to Main Content

Java and JavaScript in the Database

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!

JDBC PreparedStatement.setString problem

479996Jan 2 2006 — edited Jan 5 2006
DB version: 10g Release 2
OS version: Windows XP Release 2
JVM version: 1.5.0_06

Using the JDBC thin driver's PreparedStatement.setString(columnNumber, "") into a VARCHAR2(128) NOT NULL column followed by an executeUpdate(), generates

"java.sql.SQLException: ORA-01400: cannot insert NULL into"...

It appears that the JDBC (thin) driver does not recognize a zero length string as not being a null value. Setting VARCHAR to an empty value works in MySQL and databases, but not in Oracle 10g... What's trick for doing this with Oracle's JDBC driver?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 2 2006
Added on Jan 2 2006
1 comment
1,454 views