Re: java.net.SocketException: Broken pipe

From: Barry Lind <blind(at)xythos(dot)com>
To: Phil(dot)Hourihane(at)meridianp2p(dot)com
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: java.net.SocketException: Broken pipe
Date: 2003-09-23 16:06:17
Message-ID: 3F706F79.4020202@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Phil,

Phil(dot)Hourihane(at)meridianp2p(dot)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

Browse pgsql-jdbc by date

  From Date Subject
Next Message Chris Faulkner 2003-09-23 17:15:42 Re: authentication
Previous Message Barry Lind 2003-09-23 16:01:13 Re: authentication