pg jdbc and dbcp error - Mailing list pgsql-jdbc

From tfinneid@student.matnat.uio.no
Subject pg jdbc and dbcp error
Date
Msg-id 34154.134.32.140.234.1191248430.squirrel@webmail.uio.no
Whole thread Raw
Responses Re: pg jdbc and dbcp error  (Eric Faulhaber <ecf@goldencode.com>)
Re: pg jdbc and dbcp error  ("Mark Lewis" <mark.lewis@mir3.com>)
List pgsql-jdbc
Hi

I am having problems getting apache DBCP to work with pg jdbc.
It is claiming it can't convert a Connection into a PGConnection.

the sentence throws the exception is something like this:

    Connection con = ds.getConnection()    \\ DBCP BasicDataSource
   ((PGConnection)con).getCopyAPI.copyIntoDB("COPY attr (val1) from
STDIN"), stream);

the error message is (the message is handcopied so I might make mistakes)

ClassCastException:
org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper can
not be cast to org.postgresql.PGConnection


Anybody got any ideas whats wrong? the getConnection() returns a
javax.sql.Connection object, so casting it to PGConnection should not be a
problem.

Using the driver
   podtgresql-jdbc-8.2-505-copy-20070719.jdbc3.jar

which contains a pathc for COPY functionality
(http://kato.iki.fi/sw/db/postgresql/jdbc/copy/)


pgsql-jdbc by date:

Previous
From: tfinneid@student.matnat.uio.no
Date:
Subject: pg jdbc and dbcp
Next
From: Eric Faulhaber
Date:
Subject: Re: pg jdbc and dbcp error