You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by "Sterritt, Christopher L." <ch...@gd-ais.com> on 2006/03/08 22:36:34 UTC

Crash when Oracle stops/restarts

Hello,

	We're having a problem with iBATIS (currently using version
2.1.7).  We're using it with Spring under Tomcat, and the problem is
that if the database goes down, we have to restart Tomcat, since
(evidently) the pooled connections are unable to reconnect.

	The machine is off the net, so it's kind of a pain to include
the whole backtrace (unless it'll help), but the exception is
java.sql.SQLException: Io exception: Connection reset by peer: socket
write error.

	It the last time it's in iBATIS is in
com.ibatis.common.jdbc.SimpleDataSource.popConnection(SimpleDataSource.j
ava:620) which was called from
com.ibatis.common.jdbc.SimpleDataSource.getConnection(SimpleDataSource.j
ava:213).

	Thanks much for any help,
	--chris sterritt

RE: Crash when Oracle stops/restarts

Posted by "Fullam, Jonathan" <jf...@att.com>.
OR.....If you aren't configuring your datasource through your application server, but rather you are using a connection pool through Ibatis, you can set up your Ibatis datasource to ping connections.  For example, configure the following properties of your Ibatis simple datasource something like the following:
 
<property name="Pool.PingQuery" value="select 1 from USERS"/>

<property name="Pool.PingEnabled" value="true"/>

<property name="Pool.PingConnectionsOlderThan" value="0"/>

<property name="Pool.PingConnectionsNotUsedFor" value="3600000"/>

-Jonathan

-----Original Message-----
From: Scott Zhu [mailto:scottzhu@gmail.com]
Sent: Wednesday, March 08, 2006 4:50 PM
To: user-java@ibatis.apache.org
Subject: Re: Crash when Oracle stops/restarts


I don't think this problem is specific to oracle or ibatis. We use SQLServer (with Weblogic) and I can reproduce this problem if I stop and restart the db server. It's because some connections in the pool becomes invalid when this happens. The solution is to always test the connection or periodically test the connections. I'm not sure how this is done in Tomcat, but in weblogic, it's the "Test Reserved Connections" option. 


On 3/8/06, Sterritt, Christopher L. < chris.sterritt@gd-ais.com> wrote: 

Hello,

       We're having a problem with iBATIS (currently using version
2.1.7).  We're using it with Spring under Tomcat, and the problem is 
that if the database goes down, we have to restart Tomcat, since
(evidently) the pooled connections are unable to reconnect.

       The machine is off the net, so it's kind of a pain to include
the whole backtrace (unless it'll help), but the exception is 
java.sql.SQLException: Io exception: Connection reset by peer: socket
write error.

       It the last time it's in iBATIS is in
com.ibatis.common.jdbc.SimpleDataSource.popConnection(SimpleDataSource.j
ava:620) which was called from
com.ibatis.common.jdbc.SimpleDataSource.getConnection(SimpleDataSource.j
ava:213).

       Thanks much for any help,
       --chris sterritt




Re: Crash when Oracle stops/restarts

Posted by Scott Zhu <sc...@gmail.com>.
I don't think this problem is specific to oracle or ibatis. We use SQLServer
(with Weblogic) and I can reproduce this problem if I stop and restart the
db server. It's because some connections in the pool becomes invalid when
this happens. The solution is to always test the connection or periodically
test the connections. I'm not sure how this is done in Tomcat, but in
weblogic, it's the "Test Reserved Connections" option.

On 3/8/06, Sterritt, Christopher L. <ch...@gd-ais.com> wrote:
>
> Hello,
>
>        We're having a problem with iBATIS (currently using version
> 2.1.7).  We're using it with Spring under Tomcat, and the problem is
> that if the database goes down, we have to restart Tomcat, since
> (evidently) the pooled connections are unable to reconnect.
>
>        The machine is off the net, so it's kind of a pain to include
> the whole backtrace (unless it'll help), but the exception is
> java.sql.SQLException: Io exception: Connection reset by peer: socket
> write error.
>
>        It the last time it's in iBATIS is in
> com.ibatis.common.jdbc.SimpleDataSource.popConnection(SimpleDataSource.j
> ava:620) which was called from
> com.ibatis.common.jdbc.SimpleDataSource.getConnection(SimpleDataSource.j
> ava:213).
>
>        Thanks much for any help,
>        --chris sterritt
>