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!

Errors and truncating for TYPE_SCROLL_INSENSITIVE and long raw inserts

407580Oct 28 2003 — edited Oct 29 2003
I have found the following problems when using Oracle 9i database:

If you prepare a statement e.g.
conn.prepareStatement("insert into longraw values (?)", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);

Then try to executeUpdate on this after doing a setBinaryStream with some stream that is greater than 64K (as this table contains a long raw).
Then depending on the type of driver you are using you get the following results:

Thin driver:
java.sql.SQLException: Data size bigger than max size for this type

OCI Driver:
The data gets truncated 66000 bytes becomes 464 bytes (With NO warnings or errors)

If you insert less than 64K then the OCI Driver works and the Thin Driver still gives the same error.

If you use ResultSet.TYPE_FORWARD_ONLY, then both drivers work for any size of data up to the 2Gig limit for Long Raw.

I Think this may also be a problem for BLOB, CLOB etc but I have not tested.

The moral of the story is DO NOT use the insensitive scroll type when preparing an insert (or update?)

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 26 2003
Added on Oct 28 2003
3 comments
316 views