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@microstate.com>
Chief Technology Officer, The Microstate Corporation
Phone: 703-796-6446 URL: http://www.microstate.com/
PGP key IDs: RSA: 0x93862305 DH/DSS: 0xDAC3028E