You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "mexegg@katamail.com" <me...@katamail.com> on 2003/03/28 16:11:28 UTC
DBCP + Oracle + Blob
Hi,
I have some problems with DBCP in Tomcat 4.1.24 to save something in a BLOB field in Oracle.
Usually I write this code
String ls_sql_I = "select blobField from table1";
Statement stmt = myConnection.getStatement();
ResultSet rs = prst.executeQuery();
rs.next();
BLOB blob = ((OracleResultSet)rs).getBLOB(1);
FileInputStream inStream = new FileInputStream(file);
OutputStream outStream = blob.getBinaryOutputStream();
int size = blob.getBufferSize();
byte[] buffer = new byte[size];
int length = -1;
while ((length = inStream.read(buffer)) != -1)
outStream.write(buffer, 0, length);
inStream.close();
outStream.close();
but I catch this exception:
java.lang.ClassCastException: org.apache.commons.dbcp.DelegatingResultSet
It's possible to save a blob field in Oracle without OracleResultSet?
Or it's possible to configure Tomcat to use a Oracle DataSource, and not DBCP?
Many thanks in advance,
Marco
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: DBCP + Oracle + Blob
Posted by Tim Funk <fu...@joedog.org>.
I think this is more for commons-user but heres a try:
((DelegatingResultSet)rs).getDelegate() should give you the underlying
ResultSet.
-Tim
mexegg@katamail.com wrote:
> Hi,
> I have some problems with DBCP in Tomcat 4.1.24 to save something in a BLOB field in Oracle.
> Usually I write this code
>
> String ls_sql_I = "select blobField from table1";
> Statement stmt = myConnection.getStatement();
> ResultSet rs = prst.executeQuery();
> rs.next();
>
> BLOB blob = ((OracleResultSet)rs).getBLOB(1);
> FileInputStream inStream = new FileInputStream(file);
> OutputStream outStream = blob.getBinaryOutputStream();
>
> int size = blob.getBufferSize();
> byte[] buffer = new byte[size];
> int length = -1;
> while ((length = inStream.read(buffer)) != -1)
> outStream.write(buffer, 0, length);
>
> inStream.close();
> outStream.close();
>
> but I catch this exception:
>
> java.lang.ClassCastException: org.apache.commons.dbcp.DelegatingResultSet
>
> It's possible to save a blob field in Oracle without OracleResultSet?
> Or it's possible to configure Tomcat to use a Oracle DataSource, and not DBCP?
>
> Many thanks in advance,
> Marco
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org