Re: jndi datsource pooling

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Feb 20 2003 - 22:40:37 EST

  • Next message: Dave Paules: "Obj Entity loses capitilization on attributes"

    Hmm, wonder what is the reason for timeout. I just tried our Struts
    tutorial, only configured with JNDI DataSource, just like yours, on
    Oracle 9i. As expected, no timeouts occur by themselves. Is it possible
    that you have network problems or your Oracle server was restarted?

    Anyway, there was a related thread on this list not so long ago:

      http://objectstyle.org/cayenne/lists/cayenne-user/2003/01/0025.html

    Basically, there is no reasonable *generic* way to check connection
    status when unchecking it from the pool. Any checks would result in an
    extra database trip that defies the idea of pooling. MySQL (as discussed
    in the message above) provides the way to reconnect transparently.
    Oracle, AFAIK, does not.

    I guess you should investigate pools recommended by Tomcat docs:

    http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html

    This should work with Cayenne just as well. Let us know if this fixed
    the timeout.

    As for Cayenne future development in this area, I guess sometime around
    1.1 we will add the ability to use pools native to the drivers. Those
    (hopefully) will be aware of such things like timed out connections.

    Andrus

    John Poole wrote:
    > Hi,
    >
    > Our first attempt with Cayenne is working out great. The one
    > issue we have is that we’re getting an exception when a web application
    > idles for too long.( ~30 minutes?) It looks to me as though the jdbc
    > connection is timing out, and then the application tries to use it
    > without testing it. Are we doing something wrong? Should be using a
    > connection pool other than the one that comes with Cayennne.
    >
    > Thanks for any info,
    >
    >
    >
    > John
    >
    >
    > <Exception>
    > java.sql.SQLException: Io exception: Connection reset by peer: socket write error
    > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114)
    > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:156)
    > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
    > at oracle.jdbc.driver.OracleConnection.close(OracleConnection.java:559)
    > at org.objectstyle.cayenne.conn.PooledConnectionImpl.close(PooledConnectionImpl.java:106)
    > at org.objectstyle.cayenne.conn.PooledConnectionImpl.returnConnectionToThePool(PooledConnectionImpl.java:137)
    > at org.objectstyle.cayenne.conn.ConnectionWrapper.close(ConnectionWrapper.java:129)
    > at org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:336)
    >
    > ... 41 more
    >



    This archive was generated by hypermail 2.0.0 : Thu Feb 20 2003 - 22:41:40 EST