pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <craig@postnewspapers.com.au>
To: Andreas <ml@3.141592654.de>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: keeping Connection alive
Date: Tue, 15 Dec 2009 09:57:53 +0800
Message-ID: <4B26ED21.3010607@postnewspapers.com.au> (raw)
In-Reply-To: <26903539.10.1260802418802.JavaMail.root@store1.zcs.ext.wpsrv.net>
References: <26903539.10.1260802418802.JavaMail.root@store1.zcs.ext.wpsrv.net>

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



view thread (12+ messages)  latest in thread

Message-ID: <4B26ED21.3010607@postnewspapers.com.au>
Permalink:  ../4B26ED21.3010607@postnewspapers.com.au/
Also on:    postgresql.org/message-id/4B26ED21.3010607@postnewspapers.com.au

 · 

reply

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: craig@postnewspapers.com.au, ml@3.141592654.de
  Subject: Re: keeping Connection alive
  In-Reply-To: <4B26ED21.3010607@postnewspapers.com.au>
  References: <26903539.10.1260802418802.JavaMail.root@store1.zcs.ext.wpsrv.net> <4B26ED21.3010607@postnewspapers.com.au>

* 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