aspose file tools*
The moose likes JDBC and the fly likes getting a CLOB value as a String object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "getting a CLOB value as a String object" Watch "getting a CLOB value as a String object" New topic
Author

getting a CLOB value as a String object

Ross Varlese
Greenhorn

Joined: Jan 27, 2003
Posts: 6
Hi,
i'm trying to get a Clob value called "announcementDb" into a string object for outputting some XSLT tags within java. I'm using the following code as recommended on several sites like java.sun.com:
Clob announcementDb = rset.getClob("announcements");
long len = announcementDb.length();
String announcementOut = announcementDb.getSubString(1, len);
but i'm still getting errors firstly being that the getSubstring doesnt like the data type Long and is looking for an Int. when i replace this with and Int it runs but crashes why I run this query???
any hints would be helpful, cheers.
Michael Zalewski
Ranch Hand

Joined: Apr 23, 2002
Posts: 168
That's cuz a CLOB can have more data than can fit into a String. You have to cast the long to an int.

Is this what you already tried when you said it 'crashed'? If so, you need to provide more details.
Ross Varlese
Greenhorn

Joined: Jan 27, 2003
Posts: 6
I've altered the code but i'm still getting an error.
Root cause:
java.lang.AbstractMethodError: oracle/jdbc/driver/OracleResultSet.getClob

am I missing a driver or something?
Neha Ashok
Greenhorn

Joined: Dec 12, 2002
Posts: 26
Root cause:
java.lang.AbstractMethodError: oracle/jdbc/driver/OracleResultSet.getClob()
----------------------------------------------
What is the driver that you are using and servlet engine ?
Hopeful it is classes12.jar and oracle/ Tomcat servlet engine . I've encountered the same error sometimes back. There occurs a conflict between oracle.sql.getClob() and java.sql.getClob() functions. Please check whether classes12.jar contain java.sql package and if any found remove them and package them.
Good Luck
[ January 28, 2003: Message edited by: Subha Ganapathy ]
[ January 28, 2003: Message edited by: Subha Ganapathy ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getting a CLOB value as a String object