Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

preparedStatement

 
Ann Toh
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • 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...
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the JDBC forum...
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • 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 ).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic