From: Thomas Finneid <tfinneid@fcon.no>
To: Craig Ringer <craig@postnewspapers.com.au>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Connection exceptions
Date: Sat, 20 Jun 2009 10:44:04 +0200
Message-ID: <4A3CA154.4090205@fcon.no> (raw)
In-Reply-To: <1245469155.1624.6.camel@ayaki>
References: <54338.134.32.140.234.1245407835.squirrel@fcon.no>
<1245469155.1624.6.camel@ayaki>
Craig Ringer wrote:
> Most of your question really deals with the connection pooler you're
> using, rather than JDBC its self. I'd start with the documentation for
> DBCP.
I have looked at it, and its really poor, but I'll look for a mailing
list to see if I can get answers there.
Not sure if anybody here can answer this question, but one thing I dont
understand is the separation between DBCP and the pooler and who do
what. Apparently they are two different apache-commons packages.
Anybody know anything about these details or where I can find any
documentation or articles about it?
> shouldn't care at what point in the process the exception was thrown.
> When you catch it, you can test the SQLState to see if the error is
> possibly transient and be prepared to retry the operation. (deadlocked
> transaction? OK, retry. Connection broken? Obtain a new connection and
> retry. etc)
My main algorithm is to not care, but as soon as a problem occurs,
return the connection to the pool and let the pool deal with its
condition, then get a new connection and try again. Repeat three times
and then fail by throwing an exception to the client (after appropriate
cleanup and logging.)
regards
thomas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: tfinneid@fcon.no, craig@postnewspapers.com.au
Subject: Re: Connection exceptions
In-Reply-To: <4A3CA154.4090205@fcon.no>
References: <54338.134.32.140.234.1245407835.squirrel@fcon.no> <1245469155.1624.6.camel@ayaki> <4A3CA154.4090205@fcon.no>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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