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

Re: to much process

From: Richard Bullington-McGuire <rbulling(at)microstate(dot)com>
To: Didier Bretin <dbr(at)informactis(dot)com>
Cc: pgsql-jdbc <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: to much process
Date: 2001-01-29 15:27:34
Message-ID: Pine.LNX.4.31.0101291017180.1036-100000@polymorphic.microstate.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
On Mon, 29 Jan 2001, Didier Bretin wrote:

> Apparently, the connections opened are not close by the garbage
> collector ...
>
> Is there a solution to avoid such problem ?

There are several solutions:

* Make postgresql start with a higher number of possible processes:

postmaster -i -B 200 -N 100

This won't get to the underlying cause of your problem, but it may
alleviate the symptoms enough to buy you time to fix the problem.

* Ensure that you close the connections every time after you open them:

Connection con = null;
Statement stmt = null;
try
{
  con = DriverManager.getConnection (url, myUser, myPassword);
  stmt = con.createStatement();
  // The rest of your JDBC code that actually does work goes here...
}
catch (SQLException e)
{
  e.printStackTrace();
  throw e;
}
finally
{
  if (con != null)
    con.close();
}

This is safe, but has a performance penalty associated with creating the
new connection and associated postgres process every time.

* Use a connection pooling mechanism like PoolMan:
<http://poolman.sourceforge.net/index.shtml>

Using connection pooling will lead to higher performance for your
database application.

-- 
 Richard Bullington-McGuire  <rbulling(at)microstate(dot)com>
 Chief Technology Officer, The Microstate Corporation
 Phone: 703-796-6446  URL: http://www.microstate.com/
 PGP key IDs:    RSA: 0x93862305   DH/DSS: 0xDAC3028E


In response to

Responses

pgsql-jdbc by date

Next:From: Wayne JohnsonDate: 2001-01-29 15:53:47
Subject: Postgresql and JDBC
Previous:From: Jean-Francois BurdetDate: 2001-01-29 11:11:14
Subject: jdbc: v7.1 bug (letter accent)

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