Menu

#16 Invalid parameter for clob.getSubString()

closed-fixed
nobody
None
5
2004-07-27
2004-07-23
R. Brendler
No

When attempting to display CLOB results in an Oracle
test, I am getting an unsupported datatype error.

After chasing this one for a while, I found that the code
to get the MD5 string representation for a CLOB
(SqlTypeUtils.convertToString()) is calling:

clob.getSubString(0,...)

This call throws a SqlException (using the Oracle "thin"
jdbc driver), which is displayed as an unsupported
datatype error.

The javadoc for the java.sql.clob class specifies that the
start position should be 1-based, not 0-based. If I
change this to:

clob.getSubString(1,...)

the error goes away and everything works as expected.

From code inspection it appears that the code for BLOBs
has the same issue, but I have not tested this yet.

Discussion

  • Sujit Pal

    Sujit Pal - 2004-07-27
    • status: open --> closed-fixed
     
  • Sujit Pal

    Sujit Pal - 2004-07-27

    Logged In: YES
    user_id=184803

    Thank you for the fix, you are correct, it should also apply
    to BLOBs. I will put these fixes into CVS, and also add test
    cases for CLOB and BLOB in my mock test framework. They
    should be generally available in the next release.

     

Log in to post a comment.