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 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Wayne Johnson | 2001-01-29 15:53:47 | Postgresql and JDBC |
Previous Message | Jean-Francois Burdet | 2001-01-29 11:11:14 | jdbc: v7.1 bug (letter accent) |