Re: Idle connection errors

From: Steve Wells (websystem..mail.com)
Date: Tue Apr 04 2006 - 19:15:06 EDT

  • Next message: Andrus Adamchik: "Re: It's a long night.."

    Thanks Andrus,

    I added testOnBorrow and validationQuery to my Tomcat server.xml, global
    resource:

    <GlobalNamingResources>
       <Resource
          name="jdbc/GlobalDataSource"
          type="javax.sql.DataSource"
          driverClassName="net.sourceforge.jtds.jdbc.Driver"
          *testOnBorrow="true"
          validationQuery="SELECT 1"*
       .....

    I also added "*autoReconnect=true" *to the JDBC url, though I think in this
    case the driver ignores it.

    It seems ok so far, but I'll need more time to prove it.

    Steve

    On 03/04/06, Andrus Adamchik <andru..bjectstyle.org> wrote:
    >
    > Some drivers support auto-reconnect parameter:
    >
    > http://objectstyle.org/confluence/display/CAY/Reconnect
    >
    > jTDS doesn't seem to support that. From the stack trace, you are
    > using a DBCP connection pool. IIRC DBCP allows transparent reconnect
    > with any driver. You'd have to check DBCP docs on that.
    >
    > Andrus
    >
    >
    > On Apr 3, 2006, at 5:34 AM, Steve Wells wrote:
    > > Hi,
    > >
    > > If we try and run a query after the connection have been idle for
    > > some time,
    > > many hours (sorry I don't exactly yet know how long) we get:
    > >
    > > Caused by: java.sql.SQLException: Invalid state, the Connection
    > > object is
    > > closed.
    > > at net.sourceforge.jtds.jdbc.ConnectionJDBC2.checkOpen
    > > (ConnectionJDBC2.java
    > > :1305)
    > > at net.sourceforge.jtds.jdbc.ConnectionJDBC2.prepareCall (
    > > ConnectionJDBC2.java:1941)
    > > at org.apache.tomcat.dbcp.dbcp.DelegatingConnection.prepareCall(
    > > DelegatingConnection.java:212)
    > > at
    > > org.apache.tomcat.dbcp.dbcp.PoolingDataSource
    > > $PoolGuardConnectionWrapper.prepareCall
    > > (PoolingDataSource.java :268)
    > > at
    > > org.objectstyle.cayenne.access.trans.ProcedureTranslator.createStateme
    > > nt
    > > (ProcedureTranslator.java:160)
    > > at
    > > org.objectstyle.cayenne.dba.sqlserver.SQLServerProcedureAction.perform
    > > Action
    > > (SQLServerProcedureAction.java :105)
    > > at org.objectstyle.cayenne.access.DataNodeQueryAction.runQuery(
    > > DataNodeQueryAction.java:95)
    > > at org.objectstyle.cayenne.access.DataNode.performQueries
    > > (DataNode.java
    > > :321)
    > > ... 54 more
    > >
    > > using SQL Server, jtds 1.2, Cayenne M10. Any thoughts please?
    >
    >



    This archive was generated by hypermail 2.0.0 : Tue Apr 04 2006 - 19:15:31 EDT