Reputation: 6369
I am having an application running fine using Spring+Hibernate+MySQL ,But some times i am getting these errors
error:
could not execute query; nested exception is org.hibernate.exception.JDBCConnectionException: could not execute query
I am running my aplication on tomcat - 7 version
so if i dont use the application for more than some time i am getting this error i dont know the time , if i restart my application then i am able to work fine i am not getting any error's
my database.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</bean>
</beans>
Is there any thing wrong in the above configuration i need to change to fix this issue
Upvotes: 0
Views: 2014
Reputation: 155
you can see a similar problem and a possible solution on this topic.
tomcat7 - jdbc datasource - This is very likely to create a memory leak
Upvotes: 0
Reputation: 2254
According to this answer , You have to put the mysql Connector/Driver in the Tomcat/lib
and not in the war. As every time you deploy the war the connector/driver will be created sometimes the garbage collector cant remove them which will ends in a memory leak.
Upvotes: 2