Hello All,
I am getting the following error message when I try to execute my program as an executable jar on a remote system.The same program works perfectly fine on my local system:
Exception in thread "main" java.sql.SQLException: Operation not allowed after ResultSet closed
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
at com.mysql.jdbc.ResultSetImpl.checkClosed(ResultSetImpl.java:794)
at com.mysql.jdbc.ResultSetImpl.next(ResultSetImpl.java:7078)
at cbr_beo_3_3.contentbased(cbr_beo_3_3.java:150)
at mainfunction.main(mainfunction.java:32)
Here is my code snippet:
public void contentbased() throws Exception
{
//connecting to the data base
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con=DriverManager.getConnection("jdbc:mysql://mysql.cs.abc.edu:3306/dbname","username","password");
Statement stmt=con.createStatement();
Statement stmt1=con.createStatement();
Statement stmt2=con.createStatement();
//result sets for the training data...
//result set containing all rows in tas table
rs2_tas_train=stmt2.executeQuery("SELECT * FROM tas_training;");
//Iterating over the tas training data
//The exception is being thrown here.
while(rs2_tas_train.next())
{
}
}
The mysql server version is 5.1.40 and the mysql-connector-java-bin.jar file version is 5.1.10.Please help me resolve this issue asap.