commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Nappin" <C.Nap...@abm-uk.com>
Subject RE: [DBCP] per-user pooling with Oracle JDBC thin driver
Date Thu, 21 Oct 2004 09:44:40 GMT
Thanks for everyone's advice - I did have the driver down in two
locations - deleting one of these solved the ClassCastException.

Cheers!

-----Original Message-----
From: Dirk Verbeeck [mailto:dirk.verbeeck@pandora.be] 
Sent: 20 October 2004 22:01
To: Jakarta Commons Users List
Subject: Re: [DBCP] per-user pooling with Oracle JDBC thin driver

This ClassCastException is a typical Classloader problem.
The oracle.sql.CLOB class has been loaded 2 times by 2 different 
classloaders.

Most likely you have a Oracle driver in common/lib and also one in 
WEB-INF/lib. Delete all driver jars except the one in common/lib.

-- Dirk

Chris Nappin wrote:

> Hi,
> 
>   I've managed to get a little further by adding a
"connection.commit()"
> call after all SELECT queries (we were only committing UPDATEs and
> INSERTs, not reads) which is a nasty workaround but needed since I
can't
> have a read-only data-source.
> 
> However, I'm now getting some *really* odd errors in our Clob-handling
> code:
> 
> java.sql.Clob realClob = rs.getClob(1);
> System.out.println("realClob classname is: " +
> realClob.getClass().getName());
>         
> if (realClob instanceof oracle.sql.CLOB) {
> 	System.out.println("realClob is a oracle.sql.CLOB");
> } else {
> 	System.out.println("realClob is NOT a oracle.sql.CLOB");
> }
> oracle.sql.CLOB clob = (oracle.sql.CLOB) realClob; 
> 
> This code prints out a classname of "oracle.sql.CLOB", but instanceof
> fails and the last line produces a ClassCastException!
> 
> That's really weird and shouldn't be possible in Java (getClass is
final
> so can't every contradict instanceof)????
> 
> Everything works fine using direct connections though, it's only when
> using DBCP that I get the above error. Does DBCP use wrapped
Connections
> and ResultSets? I've tried Oracle JDBC 9.2.0.1.0 and 9.2.0.5.0 (buggy
> but matches our dbms version) drivers, both give this error.
> 
> Cheers,
> 
>    Chris Nappin




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message