Ole Streicher wrote:
> This code gives me a class cast exception when I try to get the
> LargeObjectManager; it seems that the connection is not really a PGConnection.
>
> So, how can I access a Large Object from a connection pool?
Use a more recent driver; the 7.3 drivers are quite old and newer
drivers are backwards-compatible. The connection casting problem was
fixed in CVS some time ago:
$ cvs log org/postgresql/jdbc2/optional/PooledConnectionImpl.java
[...]
----------------------------
revision 1.6
date: 2003/01/14 05:46:49; author: barry; state: Exp; lines: +4 -3
Patch from Aaron Mulder to have pooled connections implement PGConnection
Modified Files:
jdbc/org/postgresql/jdbc2/optional/PooledConnectionImpl.java
jdbc/org/postgresql/test/jdbc2/optional/BaseDataSourceTest.java
----------------------------
Looks like this change didn't make it into the 7.3 branch (which I think
is no longer maintained, at least for JDBC purposes).
> I use the pg73jdbc3.jar from the download page to access a Postgresql 7.3.4
> database (SuSE 9.0).
> BTW, the jdbc jars provided with the SuSE distrib and also the jdbc jars
> from the Postgresql download site seem not to contain the connection pool
> classes at all. Is this on purpose?
I can't speak for SuSE, but you are mistaken about the
jdbc.postgresql.org drivers:
> $ ls -l pg73jdbc3.jar
> -rw-r--r-- 1 oliver oliver 184505 Aug 8 2003 pg73jdbc3.jar
> $ jar tvf pg73jdbc3.jar | grep -i pool
> 2164 Thu Aug 07 10:57:50 NZST 2003 org/postgresql/jdbc3/Jdbc3ConnectionPool.class
> 459 Thu Aug 07 10:57:50 NZST 2003 org/postgresql/jdbc3/Jdbc3PooledConnection.class
> 3005 Thu Aug 07 10:57:50 NZST 2003 org/postgresql/jdbc3/Jdbc3PoolingDataSource.class
> 1602 Thu Aug 07 10:57:50 NZST 2003 org/postgresql/jdbc2/optional/ConnectionPool.class
> 3338 Thu Aug 07 10:57:50 NZST 2003 org/postgresql/jdbc2/optional/PooledConnectionImpl$ConnectionHandler.class
> 4209 Thu Aug 07 10:57:50 NZST 2003 org/postgresql/jdbc2/optional/PooledConnectionImpl.class
> 1753 Thu Aug 07 10:57:50 NZST 2003 org/postgresql/jdbc2/optional/PoolingDataSource$1.class
> 7258 Thu Aug 07 10:57:50 NZST 2003 org/postgresql/jdbc2/optional/PoolingDataSource.class
-O