In case anyone else has this problem,
this setup in server.xml corrected the issue we were having with
database connection timeouts to Oracle.
I.e. Adding the Validation query does the same thing as adding
"?autoReconnect=true" to a MySQL url.
John
------------------------------------------------------------------
<Resource name="jdbc/pixx" auth="Container" type="javax.sql.DataSource"
/>
- <ResourceParams name="jdbc/pixx">
- <parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
- <parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
- <parameter>
<name>url</name>
<value>jdbc:oracle:thin..vro:1521:pixx</value>
</parameter>
- <parameter>
<name>username</name>
<value>username</value>
</parameter>
- <parameter>
<name>password</name>
<value>password</value>
</parameter>
- <parameter>
<name>maxActive</name>
<value>20</value>
</parameter>
- <parameter>
<name>maxIdle</name>
<value>10</value>
</parameter>
- <parameter>
<name>maxWait</name>
<value>-1</value>
</parameter>
- <parameter>
<name>validationQuery</name>
<value>select * from global_name</value>
</parameter>
</ResourceParams>
-----Original Message-----
From: Andrus Adamchik [mailto:andru..bjectstyle.org]
Sent: February 20, 2003 8:41 PM
To: cayenne-use..bjectstyle.org
Subject: Re: jndi datsource pooling
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(PooledConnection
Impl.java:106)
> at
org.objectstyle.cayenne.conn.PooledConnectionImpl.returnConnectionToTheP
ool(PooledConnectionImpl.java:137)
> at
org.objectstyle.cayenne.conn.ConnectionWrapper.close(ConnectionWrapper.j
ava:129)
> at
org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:336
)
>
> ... 41 more
>
This archive was generated by hypermail 2.0.0 : Wed Feb 26 2003 - 11:12:43 EST