aspose file tools*
The moose likes JDBC and the fly likes preparedStatement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "preparedStatement" Watch "preparedStatement" New topic
Author

preparedStatement

Ann Toh
Ranch Hand

Joined: Jul 18, 2003
Posts: 45
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

Joined: Dec 10, 2001
Posts: 7023
Moving this to the JDBC forum...


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

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 ).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: preparedStatement