| Author |
nested ResultSets
|
rammie singh
Ranch Hand
Joined: Mar 26, 2009
Posts: 116
|
|
hi every body
i am using nested servlet and it is giving me this error. when i am using single instances of ResultSet and Statement
java.sql.SQLException: Operation not allowed after ResultSet closed
when i am using different instances of ResultSet and Statement
it gives me java.lang.NullPointerException
my code is
here only one object of javabean is able to set into ArrayList and no others
and it gives error: java.sql.SQLException: Operation not allowed after ResultSet closed
in second case
i am using different instances of resultSet and Statement
and no object is set in ArrayList and it gives error : java.lang.NullPointerException
code is
can any one please suggest me the solution.
Thanks and regards.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56540
|
|
|
Nothing to do with Servlets; moved to JDBC.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
In your first example while you are iterating through your results set you reassing the variable rs to another results set. That is never going to work.
What line does the NullPointerException occur on?
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
rammie singh
Ranch Hand
Joined: Mar 26, 2009
Posts: 116
|
|
hi
true ..in first case the resultSet rs is being reassigned.
but ,then second case should work.
In second case it is giving nullPointer exception.
|
 |
Balu Sadhasivam
Ranch Hand
Joined: Jan 01, 2009
Posts: 874
|
|
In second case it is giving nullPointer exception
it will throw definitely. where is st1 initialized ?
|
 |
rammie singh
Ranch Hand
Joined: Mar 26, 2009
Posts: 116
|
|
|
it is initiallised at the start of this function.
|
 |
Balu Sadhasivam
Ranch Hand
Joined: Jan 01, 2009
Posts: 874
|
|
it is initiallised at the start of this function.
where is the relevant code for that ? Check again , its not initialized. only st is initialized , not st1.
|
 |
 |
|
|
subject: nested ResultSets
|
|
|