I'm connecting to a sqlite DB, the connection goes well, but I'm getting this error when trying to acces ResultSet
What I am doing is the following:
1. Execute query in other method.
2. Return previous query ResultSet to this method called displayAnts(..), wich I give two parameters, first the ResultSet ( I know it's working properly ), and a JTextArea object.
3. But when I access the ResultSet called rsAnts, after the "rsAnts.next()", in order to set the jta (JTextArea)
text, attached to the existing text, it crashes.
Field "1" in current table of DB is string datatype.
This is the error message when I try the code bellow...
java.sql.SQLException: ResultSet closed
at org.sqlite.RS.checkOpen(RS.java:57)
at org.sqlite.RS.findColumn(RS.java:99)
at org.sqlite.RS.getString(RS.java:243)
Code:...........................................................................................................................
public void displayAnts(ResultSet rsAnts, JTextArea jta) {
try {
while (rsAnts.next()) {
jta.setText(jta.getText() + rsAnts.getString(1));
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
...................................................................................................................................
Help will be greatly appreciated. Thanks in advance.