Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

getting CLOB data from Oracle8i

11 views
Skip to first unread message

Rich

unread,
Jun 28, 1999, 3:00:00 AM6/28/99
to
I'm trying to get the data out of an oracle.sql.CLOB. I can get data in
there using the example jdbc code, but I run into this when I use the
provided example code to read the same CLOB out:

java.io.IOException: ORA-21560: argument 2 is null, invalid, or out of
range
ORA-06512: at "SYS.DBMS_LOB", line 648
ORA-06512: at line 1

at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.io.IOException.<init>(Compiled Code)
at oracle.jdbc.dbaccess.DBError.SQLToIOException(Compiled Code)
at oracle.jdbc.driver.OracleClobReader.needChars(Compiled Code)
at oracle.jdbc.driver.OracleClobReader.read(Compiled Code)
at java.io.Reader.read(Compiled Code)
at
com.sun.etc.request.newrequest.NewRequest_d.getClobContent(Compiled
Code)
at
com.sun.etc.request.newrequest.NewRequest_d.outputHTML(Compiled Code)
at com.sun.etc.request.SqlParser.svc(Compiled Code)
at com.sun.etc.request.SqlServlet.doPost(Compiled Code)
at javax.servlet.http.HttpServlet.service(Compiled Code)
at javax.servlet.http.HttpServlet.service(Compiled Code)
at org.apache.jserv.JServConnection.processRequest(Compiled
Code)
at org.apache.jserv.JServConnection.run(Compiled Code)
at java.lang.Thread.run(Compiled Code)


The code is as follows:


clob = ((OracleResultSet)rs).getCLOB(6);
System.err.println("CLOB ID:" + clob); // outputs
"CLOB ID:oracle.sql.CLOB@1fa5575b"
Reader rdr = clob.getCharacterStream();
char[] buf = new char[10];
int length = 0;

while ((length = rdr.read(buf)) != -1) {
System.err.println("Writing" + length + " chars:");
for (int i=0; i<length; i++) System.err.print(buf[i]);
System.err.println();
}

Any help would be most appreciated :)

Rich


Elias Stelingos

unread,
Jun 30, 1999, 3:00:00 AM6/30/99
to Rich
Hi Rich !

Are you using the JDBC-thin driver ? If so, don't. I wonder how you
managed to feed
data into the database anyway.
I had a similar problem (Oracle 8.1.5 NT) until yesterday and the
solution to this was to use the OCI8-JDBC driver. In
http://www.oracle.com/ideveloper/99article/ta010199.html they tell us
that currently LOBs are not supported by JDBC thin.

Elias

Rich

unread,
Jun 30, 1999, 3:00:00 AM6/30/99
to el...@opus5.de
Elias Stelingos wrote:

> Hi Rich !
>
> Are you using the JDBC-thin driver ? If so, don't. I wonder how you
> managed to feed
> data into the database anyway.

Amazing, eh? I can actually get the data out with getSubString() too,
though that's horribly inefficient with larger CLOBs. Oh well, guess
it's time to switch to the oci8 driver.

My web server is on a different machine from my DB, and the oci driver
requires a shared library. I've located the libocijdbc8.so (this is
under Solaris), but I don't know how to tell the jvm to find it when
loading the driver. You wouldn't happen to know this, would you?

Rich


0 new messages