• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

SQL Update not happening

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...

 
Ranch Hand
Posts: 312
MS IE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic