ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kai Grabfelder <nos...@kinokai.de>
Subject Re: mysql issue...
Date Sun, 21 Dec 2008 22:10:17 GMT
Hi,

this is kind of a mysql "feature". Connections that are not used for some time are automatically
closed. If
you are using spring you can workaround this with the following datasource configuration:

<bean id="nativeDataSource" class="org.apache.commons.dbcp.BasicDataSource">
  <property name="driverClassName" value="${jdbc.driverClassName}" />
  <property name="url" value="jdbc:mysql://localhost/wemwannwas" />
  <property name="username" value="${jdbc.username}" />
  <property name="password" value="${jdbc.password}" />
  <property name="maxActive" value="15"></property>
  <property name="testWhileIdle" value="true"></property>
  <property name="validationQuery" value="select 1 from dual"/>
 </bean>

Regards

Kai

--- Original Nachricht ---
Absender: pady
Datum: 21.12.2008 19:59
> 
> Hi,
> 
> ibatis 2.3
> mysql 5.0.29
> mysql-connector 5.0.4
> 
> After a few hours of my web app being idle, when I try to connect I get this
> exception, when i try to connect through ibatis:
> 
> com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException:
> Connection.close() has already been called. Invalid operation in this state.
> 
> I have googled, checked the mysql archives etc and all I find is to make
> sure the ibatis transactionmanager as external...
> 
> My transaction manager is setup as
> 
> <transactionManager type="JDBC" commitRequired="true">
> 
> <property name="SetAutoCommitAllowed" value="true"/>
> 
> <property name="DefaultAutoCommit" value="false"/>
> 
> <dataSource type="SIMPLE">
> 
> <property name="JDBC.Driver" value="com.mysql.jdbc.Driver"/>
> 
> <property name="JDBC.ConnectionURL" value="jdbc:mysql://localhost/***"/>
> 
> <property name="JDBC.Username" value="***"/>
> 
> <property name="JDBC.Password" value="***"/>
> 
> </dataSource>
> 
> </transactionManager>
> 
> 
> 
> I want to know whether users here have seen the error above and how they
> solved it.
> 
> 
> 
> Thx
> 
> -- pady
> 
> 
> 
> 


Mime
View raw message