The error is as follows:
Java.sql.SQLException:No Operations allowed after connection closed.
At com.mysql.jdbc.Connection.checkClosed (connection.java:1842)
At Com.mysql.jdbc.Connection.prepareStatement (connection.java:4260)
At Com.mysql.jdbc.Connection.prepareStatement (connection.java:4226)
At Hist.nws.db.SqlHelper.query (sqlhelper.java:140)
At Hist.nws.service.OperationService.queryActivity (operationservice.java:60)
At Mainframe.<init> (mainframe.java:115)
At Mainframe.main (mainframe.java:331)
Cause of Error:
private static Connection conn = null;
private static PreparedStatement PS = null;
private static ResultSet rs = null;
The connection to the database is connection static, and the program shares this connection. So the first time on the database operation is not a problem, when the connection closed, the second time also want to operate the database connection certainly does not exist.
Unable to start after Java database connection is closed