Re: Connection pools with LOB?

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Ole Streicher <ole-usenet-spam(at)gmx(dot)net>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Connection pools with LOB?
Date: 2004-02-28 23:53:53
Message-ID: 40412A11.2060608@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Marc G. Fournier 2004-02-29 02:11:49 Re: Where has the source code moved to?
Previous Message Oliver Jowett 2004-02-28 23:33:38 Re: Jdbc3PoolingDataSource and Statement relationship???