tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: jdbc driver fails with tomcat
Date Fri, 26 Sep 2008 16:57:34 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dini,

Dini Omar wrote:
> I am trying to send an array to a pl/sql module but for some reason i am
> unable to get the connection object.
> 
> Here is the line of code that fails
> 
> [code]
> Connection conn = null;
> ArrayDescriptor rectabDescriptor =
> ArrayDescriptor.createDescriptor("CCS21_CONSIGNMENTLIST_TYPE",conn);

It's odd that your exception says DelegatingCallableStatement (which is
the actual type of the object being casted) when the line indicated
neither performs a cast, nor does anything with a statement.

Are you sure this is the right line number?

> <<FAILS HERE<<
> ARRAY awbNoHwbs = new ARRAY(rectabDescriptor,conn,childLessAwbs);
> ARRAY hwbs = new ARRAY(rectabDescriptor,conn,hwbList);
> 
> OracleCallableStatement cst =
> (OracleCallableStatement)conn.prepareCall(stp.SUBMIT_CONSIGNMENT_STORED_PROC);

I'm guessing that the above line is the one where the problem is really
occurring. conn.prepareCall returns a DelegatingCallableStatement
instead of the Oracle-specific one you are expecting.

Do you /need/ to use OracleCallableStatement, here? If not, you should
simply use java.sql.CallableStatement and you should be good to go.

If you need to access the underlying OracleCallableStatement, then
you'll need to go through some hoops to get that actual object. Perhaps
something like this:

DelegatingCallableStatement dcs =
conn.prepareCall(stp.SUBMIT_CONSIGNMENT_STORED_PROC);

OracleCallableStatement =
(OracleCallableStatement)dcs.getInnermostDelegate();

This is a big dangerous, though, because Tomcat doesn't make too many
guarantees about the structure of the objects in the dbcp.dbcp package.
Also, the "innermost delegate" might not actually be your Oracle statement.

My advise would be to try to stick to using only objects and interfaces
in the JDBC API unless you absolutely need to (for instance, to create
Oracle-specific arrays from templates or whatever this stuff is).

The Oracle driver ought to allow you to interact a bit more naturally
with the JDBC API and not require you to use OracleCallableStatement
objects and stuff like that.

Hope that helps,
- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjdFH4ACgkQ9CaO5/Lv0PARMgCgphBlDrwQWBWW73/a2cAG82Ju
RaUAmwSmGtca3RVQc91kORrMuXiy2DXs
=kZ3E
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message