MySQLNonTransientConnectionException in jdbc program at run time

Posted by Sunil Kumar Sahoo on Stack Overflow See other posts from Stack Overflow or by Sunil Kumar Sahoo
Published on 2010-02-19T15:21:15Z Indexed on 2010/04/03 1:43 UTC
Read the original article Hit count: 395

Filed under:
|
|

Hi I have created jdbc mysql connection. my program works fine for simple execution of query.

But if i run the same program for more than 10 hour and execute query then i receives the following mysql exception.

I have not used close() method anywhere. i created database connection and opened it forever and always execute query. there is no where that i explicitly mentioned timeout for connection. i am unable to identify the problem

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Connection.close() has already been called. Invalid operation in this state. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after statement closed. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

sample code for database connection:

String driver = PropertyReader.getDriver(); String url = dbURLPath; Class.forName(driver); connectToServerDB = DriverManager.getConnection(url); connectToServerDB.setAutoCommit(false);

© Stack Overflow or respective owner

Related posts about mysql

Related posts about jdbc