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 21:21:22 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ziggy,

Ziggy O wrote:
> When i debug the code, it doesnt get to the point where i am initialising
> the OracleCallableStatement object. It failed just after the initialisation
> of the ArrayDescriptor object.

Strange. Are you sure you are working with matching binary and source
versions?

> I have tried to change it to use CallableStatement and im now getting
> another error. Here is how i've changed it to.
> 
> CallableStatement cst =
> conn.prepareCall(stp.SUBMIT_CONSIGNMENT_STORED_PROC);
> 
> ArrayDescriptor rectabDescriptor =
> ArrayDescriptor.createDescriptor("CCS21_CONSIGNMENTLIST_TYPE",conn);

[snip]

> java.lang.ClassCastException:
> org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper
>     at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:149)
>     at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:115)
>     at com.abbt.ccs21.data.accessors.ConsignmentDAO.submitDeclaration(ConsignmentDAO.java:301)

Now, this stack trace makes more sense to me. It looks like Oracle's
driver expects the Connection object passed into the createDescriptor
method to be an Oracle-specific connection.

Try doing this instead:

ArrayDescriptor rectabDescriptor =
ArrayDescriptor.createDescriptor("CCS21_CONSIGNMENTLIST_TYPE",
(((DelegatingConnection)conn).getInnermostDelegate());

Hopefully, that will get the Oracle-specific Connection object
passed-into that method and then the driver will work properly.

On a side note, could you use the java.sql.Array interface instead of
the Oracle-specific ones? I've never done this, and it isn't entirely
clear how to so it, but this might work:

Array myArray = conn.createArrayOf("dataType", elements);

Then you should be able to use the PreparedStatement.setArray method to
assign it to a parameter. Connection.createArrayOf is part of JDBC 4.0
(Java 6), which you might not be using at this point.

Just a thought.

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

iEYEARECAAYFAkjdUlIACgkQ9CaO5/Lv0PBZegCeIuHcpXn6x/eP3ZvFooy4twf0
XOEAoMCf0ZxTBTtxcB86hq8ax1qYM0Fm
=6yjk
-----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