pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pljava reinitializing pool after every invocation
2+ messages / 2 participants
[nested] [flat]

* pljava reinitializing pool after every invocation
@ 2006-03-21 01:12 Sriram Dandapani <sdandapani@counterpane.com>
  2006-03-21 01:30 ` Re: pljava reinitializing pool after every invocation Kris Jurka <books@ejurka.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Sriram Dandapani @ 2006-03-21 01:12 UTC (permalink / raw)
  To: pgsql-jdbc

Hi

 

Following is the scenario:

 

A plpgsql function calls a java method using pljava. The initialization
of the jdbc pool seems to be happening with every call to the
getConnection method.

Is there a way to implement singletons within pljava

 

This is the java code that initializes the pool

 

private static Jdbc3PoolingDataSource pool;

private static Logger logger = Logger.getLogger(PostgresAdapter.class);

private static PropertyResourceBundle resourceBundle;

                        

                        public static void setupPool() throws Exception
{

                                    logger.info("***setting up postgres
pool");

                                    PropertyResourceBundle
resourceBundle = null;

                                     resourceBundle = new
PropertyResourceBundle(new FileInputStream("postgres-ds.properties"));

                                    pool = new Jdbc3PoolingDataSource();

                                    logger.info("***finished setting up
postgres pool");

 
pool.setServerName(resourceBundle.getString("serverName"));

 
pool.setPortNumber(Integer.parseInt(resourceBundle.getString("portNumber
")));

 
pool.setDatabaseName(resourceBundle.getString("databaseName"));

 
pool.setUser(resourceBundle.getString("user"));

 
pool.setPassword(resourceBundle.getString("password"));

                                    pool.setMaxConnections(25);

                        }

 

                        public static Connection getConnection() throws
Exception {

                                    if(pool == null) {

                                                setupPool();

                                    }

                                    Connection con =
pool.getConnection();

                                    con.setAutoCommit(false);

                                    return con;

                        }

 

Many thx in advance for answers

 

Sriram

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: pljava reinitializing pool after every invocation
  2006-03-21 01:12 pljava reinitializing pool after every invocation Sriram Dandapani <sdandapani@counterpane.com>
@ 2006-03-21 01:30 ` Kris Jurka <books@ejurka.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Kris Jurka @ 2006-03-21 01:30 UTC (permalink / raw)
  To: Sriram Dandapani <sdandapani@counterpane.com>; +Cc: pgsql-jdbc



On Mon, 20 Mar 2006, Sriram Dandapani wrote:

>
> A plpgsql function calls a java method using pljava. The initialization
> of the jdbc pool seems to be happening with every call to the
> getConnection method.

pljava questions should be asked here:

http://gborg.postgresql.org/mailman/listinfo/pljava-dev

Kris Jurka




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2006-03-21 01:30 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-03-21 01:12 pljava reinitializing pool after every invocation Sriram Dandapani <sdandapani@counterpane.com>
2006-03-21 01:30 ` Kris Jurka <books@ejurka.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox