Can anyone tell how to read CLOB data from oracle database. The below reflection method is not working
Clob clob = resultSet.getClob("clobdata"); Class clobClass = Class.forName("oracle.sql.CLOB"); Method bsv = clobClass.getMethod("binaryStreamValue", new Class); is = (InputStream) bsv.invoke(clob, new Object);
To treat clobs as easy string fields, set jdbc connection property and enjoy.
Clob in oracle uses its own connection. When you retrieve clob ordinarily (the same to blob), you should use the api methods to access content as i/o steams. Also take into your consideration the fact, that oracle uses one special type of clobs - empty clobs (and empty blobs as well).
And the last, if you prefer usage of oracle CLOB class, then cast java.sql.Clob to oracle.sql.CLOB and enjoy usage of oracle specific methods. Usage of reflection in jdbc is strongly discouraged