wood burning stoves 2.0*
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
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: 61413
    
  67

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
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30749
    
156

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