Re: keeping Connection alive

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Andreas <ml(at)3(dot)141592654(dot)de>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: keeping Connection alive
Date: 2009-12-15 01:57:53
Message-ID: 4B26ED21.3010607@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On 14/12/2009 10:53 PM, Andreas wrote:

>> ... where "invalidateConnection(Connection, Throwable)" tells the
>> provider/pool that the connection is broken.
>
> I'm not sure how to do this, because AFAIK a DataSource implementation does not have a method for invalidating the Connection. How to do this when implementing against standard interfaces?

If you're using JNDI to get a DataSource and calling getConnection(...)
on it to obtain a JDBC connection, then there's no connection pooling
going on. You close your connectoins when you're done with them. So
there's no need to tell the DataSource the connection is broken; you
just close it and request a new one from the DataSource.

I don't currently use JNDI in my own app (though it looks like I
should), but I'm pretty sure that's how to handle it.

--
Craig Ringer

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Craig Ringer 2009-12-15 02:06:16 Re: keeping Connection alive
Previous Message Andreas 2009-12-14 14:53:38 Re: keeping Connection alive