This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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 Android Security Essentials Live Lessons this week in the Android 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: 60785
    
  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: 30130
    
150

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
 
Don't get me started about those stupid light bulbs.
 
subject: Servlet code for updating data in database
 
Similar Threads
Passing huge string to JSP..
blocking a ticket while booking it thru online in website
Calculating the number of tickets available
Changing variables dynamically
How to achieve session managemetn in servlet for ended session scenario