ibatis 数据库断开重连方法
请按以下步骤修改
jndi配置
0.ibatis/SqlMapConfig.xml
1.mysql的jdbc包放到tomcat/lib目录下
2.tomcat/conf/context.xml
配置
请按以下步骤修改
jndi配置
0.ibatis/SqlMapConfig.xml
<dataSource type="JNDI"> <property name="DataSource" value="java:comp/env/jndi/myDataSource" /> </dataSource>
1.mysql的jdbc包放到tomcat/lib目录下
2.tomcat/conf/context.xml
配置
<Resource name="jndi/myDataSource" scope="Shareable" type="javax.sql.DataSource" factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" url="jdbc:mysql://192.168.0.73:3388/gooddriver_servicer_cloud?useUnicode=TRUE&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false" driverClassName ="com.mysql.jdbc.Driver" username="gooddriver" password="1qaz2WSXcomit" maxWait="5000" maxIdle="30" maxActive="100" />