Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with my insert data page

 
albert sie
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


suppose the program will check whether the attendday < barClass if yes insert into the database. it should be more than 1 data will be insert. but when run this page error come out "Operation not allowed after ResultSet closed" juz 1 data been insert into database. is it my coding problem and how i gotta to solve my problem??
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it my coding problem and how i gotta to solve my problem??

Use a new Statement.

And don't forget to close Statments as well. We usually put all the boring close() stuff in the finally close, to make sure that everything is cleaned even when an exception occurs.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65228
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to post in the appropriate forum. This is a JDBC question even if it is being performed inappropriately in a JSP page. This topic has been moved to the JDBC forum.
 
albert sie
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to using new statement?
 
Herman Schelti
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Albert,

Satou probably means:

Statement anotherStatement = C.createStatement();
anotherStatement.executeUpdate(...);

Herman
PS: I'm really curious why you do all the JDBC-code in a page
(it's usually considered as BAD)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic