• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Intermittent Java PostgreSQL Connection closed

 
Gerry Scott
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My Java program connects using ibatis to a PostgreSQL DB server. Most of the time, the connection is fine.

However, sometimes the connection takes very long and then I get an exception stating that the connection has been closed, although I have not closed it at all. Yet later on my program still can access the DB server normally.

The stack trace is here.

Caused by: org.postgresql.util.PSQLException: This connection has been closed.
at org.postgresql.jdbc2.AbstractJdbc2Connection.checkClosed(AbstractJdbc2Connection.java:822)
at org.postgresql.jdbc2.AbstractJdbc2Connection.rollback(AbstractJdbc2Connection.java:839)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.ibatis.common.jdbc.SimpleDataSource$SimplePooledConnection.invoke(SimpleDataSource.java:958)
at com.sun.proxy.$Proxy0.rollback(Unknown Source)
at com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.rollback(JdbcTransaction.java:72)
at com.ibatis.sqlmap.engine.transaction.TransactionManager.end(TransactionManager.java:87)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.endTransaction(SqlMapExecutorDelegate.java:734)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSessionImpl.java:176)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClientImpl.java:153)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.autoEndTransaction(SqlMapExecutorDelegate.java:835)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:410)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:82)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.insert(SqlMapClientImpl.java:58)
at mblib.dao.TrxLogDAO.insertLog(TrxLogDAO.java:32)
... 10 more


Thanks in advance.
 
A.J. Côté
Ranch Hand
Posts: 417
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have any firewall or router between your application server and the database server?

Does ibastis use connection pooling?

You could look at sending any form of keep alive from ibatis jdbc driver to the database server anyway. Chances is this might solve your problem.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic