Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ResultSet Closed?

843859Dec 18 2008 — edited Nov 20 2014
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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 15 2009
Added on Dec 18 2008
2 comments
410 views