Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet code for updating data in database  RSS feed

 
J Das
Ranch Hand
Posts: 83
Firefox Browser Java MS IE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 65897
135
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 36622
475
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!