• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQL Update not happening

 
Kiran kk
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm writing a jsp file that takes theatre, movie name,cast,director,language,opendate,closedate(all are stirings). I'm getting their values in the servlet and passing them to the class to do the update.. No exceptions found.. but still the update is not happening...
here is the code below


JSP file


servlet file



class file



please help me...

 
Madhan Sundararajan Devaki
Ranch Hand
Posts: 312
Java MS IE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe, your UPDATE query requires quotes around the ? symbols, as all the values are Strings. Also, you may need to explicitly set autocommit to true. BTW I am unable to understand why you have put ps.execute() statement after the executeUpdate statement! Further, you need to move the ps.close() statement before releasing the connection.
 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it is because you are not committing your changes in database.



above mentioned commit code is missing in your AddMovieClass.
Re-run your code with commmit statement added. your problem may get solved.


By the way, why are we calling below mentioned execute statement in AddMovieClass when already executeUpdate() is called.



please use code tags to display java code in posts.

~ abhay

 
Ramesh Kumar
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes abhay and madhan are correct ,
1)you are already have ps.executeUpdate(); statement to execute your query , then why you need ps.execute(); statement ???
2)once you done with the execution part .you have to commit your changes . connection.commit() is also needed at the end .
3) i dont know what you doing with ManageConnectionClass file . if you managing your connection there . its better to close there iself .

Ramesh
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic