This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JDBC and the fly likes Servlet code for updating data in database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Servlet code for updating data in database" Watch "Servlet code for updating data in database" New topic
Author

Servlet code for updating data in database

J Das
Ranch Hand

Joined: Jul 27, 2011
Posts: 83

hi people.. i have a question related to an online bus ticket booking system.... Suppose a client gives his information in a form...(like his name, credit card number , address, email etc.) .. also he provides information on how many tickets he want.. Now suppose we have in our database table the total available tickets = 30, and if the customer buys 1 ticket, the database should be updated dynamically from the servlet , shouldn't it ?? I mean now the currently available tickets should be = 29 after posting the form .... What code is required to achieve the above... I am scratching my head... Please help me.....
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60082
    
  65

I'll be moving this to the JDBC firm as this is a database question, not a servlet question.

And, in a properly structure web app, the servlet would delegate this task to a class in the Model layer.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29287
    
140

Have you read about JDBC yet? If so, what part are you stuck on? Connecting to the database? Writing a SQL statement to decrement the count?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet code for updating data in database
 
Similar Threads
Changing variables dynamically
Calculating the number of tickets available
How to achieve session managemetn in servlet for ended session scenario
Passing huge string to JSP..
blocking a ticket while booking it thru online in website