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

Connection pools with LOB?

From: "Ole Streicher" <ole-usenet-spam(at)gmx(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Connection pools with LOB?
Date: 2004-02-25 14:15:40
Message-ID: 16496.1077718540@www8.gmx.net (view raw or flat)
Thread:
Lists: 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 +++


Responses

pgsql-jdbc by date

Next:From: Jean-Christophe ARNUDate: 2004-02-26 14:23:28
Subject: Asynchronous notifications
Previous:From: Dave CramerDate: 2004-02-25 12:40:39
Subject: Re: ΑΠ: ΑΠ:

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