Skip site navigation (1) Skip section navigation (2)

pg jdbc and dbcp error

From: tfinneid(at)student(dot)matnat(dot)uio(dot)no
To: pgsql-jdbc(at)postgresql(dot)org
Cc: kato(at)iki(dot)fi
Subject: pg jdbc and dbcp error
Date: 2007-10-01 14:20:30
Message-ID: (view raw or whole thread)
Lists: pgsql-jdbc

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)

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

Using the driver

which contains a pathc for COPY functionality


pgsql-jdbc by date

Next:From: Mark LewisDate: 2007-10-01 14:40:21
Subject: Re: pg jdbc and dbcp error
Previous:From: tfinneidDate: 2007-10-01 13:44:49
Subject: pg jdbc and dbcp

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group