my dog learned polymorphism
The moose likes JDBC and Relational Databases and the fly likes SQL Update not happening Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "SQL Update not happening" Watch "SQL Update not happening" New topic

SQL Update not happening

Kiran kk

Joined: Jun 17, 2011
Posts: 9
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

Joined: Mar 18, 2011
Posts: 312

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.

Not many get the right opportunity !
Abhay Agarwal
Ranch Hand

Joined: Feb 29, 2008
Posts: 1341

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

Joined: Oct 29, 2008
Posts: 42
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 .


I agree. Here's the link:
subject: SQL Update not happening
It's not a secret anymore!