Home Oracle's JDBC BLOB support sucks....
Post
Cancel

Oracle's JDBC BLOB support sucks....

Exception in thread "main" : java.lang.ClassCastException: javax.sql.rowset.serial.SerialBlob cannot be cast to oracle.sql.BLOB
...
Caused by: java.lang.ClassCastException: javax.sql.rowset.serial.SerialBlob cannot be cast to oracle.sql.BLOB
        at oracle.jdbc.driver.OraclePreparedStatement.setBlob(OraclePreparedStatement.java:6634)
        at oracle.jdbc.driver.OraclePreparedStatementWrapper.setBlob(OraclePreparedStatementWrapper.java:126)

The "infringing" code is this:

     SerialBlob sb1 = new SerialBlob(value);
     stmt.setBlob(5, sb1);   //column 5 is a blob, in case you're wondering


Really, why not code against standards?


EDIT 8/5/2011 19:35: Issue worked around like so:

      ByteArrayInputStream bais1 = new ByteArrayInputStream(value);
      stmt.setBinaryStream(5, bais1, value.length);
This post is licensed under CC BY 4.0 by the author.

More Vim goodness: The Power of g

Closures