• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

nested ResultSets

 
rammie singh
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64623
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing to do with Servlets; moved to JDBC.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
rammie singh
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

In second case it is giving nullPointer exception




it will throw definitely. where is st1 initialized ?
 
rammie singh
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it is initiallised at the start of this function.
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic