Connection pools with LOB? - Mailing list pgsql-jdbc

From Ole Streicher
Subject Connection pools with LOB?
Date
Msg-id 16496.1077718540@www8.gmx.net
Whole thread Raw
Responses Re: Connection pools with LOB?  (Oliver Jowett <oliver@opencloud.com>)
List pgsql-jdbc
Hi,

I tried to use a connection pool my very first time, and unfortunately it
did not work at all. I could trace it down to the following sample:

import java.sql.Connection;
import org.postgresql.largeobject.LargeObjectManager;
import org.postgresql.PGConnection;
import org.postgresql.jdbc3.Jdbc3PoolingDataSource;

public class PoolLob {
  public static void main(String[] args) {
    try {
      Jdbc3PoolingDataSource source = new Jdbc3PoolingDataSource();
      source.setDataSourceName("test Pooling");
      source.setServerName("localhost");
      source.setDatabaseName("sample");
      source.setUser("foo");
      source.setPassword("bar");
      source.setMaxConnections(10);
      Connection conn = source.getConnection();
      LargeObjectManager lobj = ((PGConnection)conn).getLargeObjectAPI();
      int oid = lobj.create();
      System.out.println("Just created a sample Object Id: " + oid);
    } catch (Throwable e) {
      e.printStackTrace();
    }
  }
}

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?

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?

Best regards,

Ole

--
GMX ProMail (250 MB Mailbox, 50 FreeSMS, Virenschutz, 2,99 EUR/Monat...)
jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++ http://www.gmx.net/derspiegel +++


pgsql-jdbc by date:

Previous
From: "David Price"
Date:
Subject: Postgres 7.4.1 JDBC Question
Next
From: andrew@pillette.com
Date:
Subject: Asynchronous WRITES