• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

preparedStatement

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Can anyone tell me how to write a prepared statement in a servlet??
i need to have 4 things, that are the select, insert, update and delete.
how do i write the prepared statement for the 4 things?? is it using 4 prepared statements or only need just 1 prepared statement??
Thanx in advance...
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving this to the JDBC forum...
 
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ann Toh:
Hi, Can anyone tell me how to write a prepared statement in a servlet??
i need to have 4 things, that are the select, insert, update and delete.
how do i write the prepared statement for the 4 things?? is it using 4 prepared statements or only need just 1 prepared statement??
Thanx in advance...

you write it the same way you would for a normal app! You will need a separate prepared statement for each part ( select, update...). In fact you'll need a new prepared statement for each query in which something other than the set parameters change. The only diff between a servlet and normal app may be the design ( connection pooling and other design features specific to web apps ).
 
The glass is neither half full or half empty. It is too big. But this tiny ad is just right:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic