Re: java.net.SocketException: Broken pipe
От | Barry Lind |
---|---|
Тема | Re: java.net.SocketException: Broken pipe |
Дата | |
Msg-id | 3F706F79.4020202@xythos.com обсуждение исходный текст |
Ответ на | java.net.SocketException: Broken pipe (Phil.Hourihane@meridianp2p.com) |
Список | 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 по дате отправления: