Re: Connection exceptions

From: Thomas Finneid <tfinneid(at)fcon(dot)no>
To: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Connection exceptions
Date: 2009-06-20 08:44:04
Message-ID: 4A3CA154.4090205@fcon.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2009-06-20 15:24:16 Re: text type handling
Previous Message Craig Ringer 2009-06-20 03:39:15 Re: Connection exceptions