ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Poitras Christian" <Christian.Poit...@ircm.qc.ca>
Subject RE: autoReconnect=true doesn't solve closed connection problem
Date Thu, 11 May 2006 17:19:58 GMT
iBatis automatically handle reconnection to databse on connection
failure.
 
To use this possibiliy, user can define a certain number of variables in
your sqlmapconfig.
 
Here is an example.
<transactionManager type="JDBC">

<dataSource type="SIMPLE">

<property value="${driver}" name="JDBC.Driver"/>

<property value="${url}" name="JDBC.ConnectionURL"/>

<property value="${username}" name="JDBC.Username"/>

<property value="${password}" name="JDBC.Password"/>

<property value="${pingquery}" name="Pool.PingQuery"/>

<property value="${pingenable}" name="Pool.PingEnabled"/>

<property value="${pingoldertime}"
name="Pool.PingConnectionsOlderThan"/>

</dataSource>

</transactionManager>

 
 
Make sure the property files contains all the properties specified. I
use.

driver=com.mysql.jdbc.Driver

url=jdbc:mysql://localhost:3306/data

username=root

password=

pingquery=SELECT 1

pingenable=true

pingoldertime=2000

 


________________________________

From: Tony Qian [mailto:daqiqian2@aol.com] 
Sent: Thursday, 11 May 2006 12:22
To: user-java@ibatis.apache.org
Subject: autoReconnect=true doesn't solve closed connection problem


All,

I set following in SglMapConfig.xml file:

 <property name="JDBC.ConnectionURL"
value="jdbc:mysql://hostName:3306/dbName?autoReconnect=true"/>

It doesn't solve Communication Failure problem due to closed connection.
Setting autoReconnection=true works when connection pool is managed by
Tomcat (DBCP). (btw, PingQuery solves the problem)

database is MySql 5.019, JDBC diver is mysql-connector-java-3.1.11.

Did I do something wrong? any suggestion?

thanks,
Tony




Mime
View raw message