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!

Exception thrown by ResultSet.getString when field is null

843854Oct 20 2004 — edited Oct 22 2004
I am using JDBC to connect to an Access database. One of the fields in the database is of type "Memo", and for many records this is empty. Java seems to throw a wobbler when it meets when of these, with:
java.sql.SQLException
	at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:285)
Not terribly descriptive...

Works fine if the field has a value in it, or if the field is of type "Text" in Access.

Curiously, there is a wasNull() method, which will inform me if the field is null - after I have called getString...

Clearly, one way around this is to wrap the getString in a try-catch block, but if there is a real error accessing the database, the data will not be retrieved, and can potentially be lost if the database is subsequently updated.

Does anyone have any advice?

AJ
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 19 2004
Added on Oct 20 2004
4 comments
782 views