Re: java.net.SocketException: Broken pipe - Mailing list pgsql-jdbc

From Barry Lind
Subject Re: java.net.SocketException: Broken pipe
Date
Msg-id 3F706F79.4020202@xythos.com
Whole thread Raw
In response to java.net.SocketException: Broken pipe  (Phil.Hourihane@meridianp2p.com)
List pgsql-jdbc
Phil,

Phil.Hourihane@meridianp2p.com wrote:
>>Phil,
>>
>>A possible cause is a firewall or some other device between the client
>>and the server that drops connections after a certain time.  (Most
>>firewall don't allow you to keep connections open indefinitely).
>>
>>thanks,
>>--Barry
>
>
> Thanks, Barrry, for your reply.
>
> Unfortunately, I don't think this is my problem.There is no firewall in
> place which would prevent a connection from lasting for any
> length of time. In fact, the statement that I am caching is built
> around a connection pool, so that the statement should not
> actually be using the same connection each time it is run at all.
>

Here is your problem.  A statement object is owned by a connection.  You
cannot cache statement objects across different connections.  What will
actually happen is if you later use the statement, it will still be
using the connection that created it, even if you have returned that
connection back to the pool.  What I suspect is happening is that your
connection pool is occasionally closing connections and it just so
happens that the connection closed is the one used by your cached
statement.  If you want to cache a statement like this, you will also
need to cache the connection that goes with that statement.

thanks,
--Barry




pgsql-jdbc by date:

Previous
From: Barry Lind
Date:
Subject: Re: authentication
Next
From: "Chris Faulkner"
Date:
Subject: Re: authentication