Selected References: 
Gal Shachor; Tomcat Apache HOWTO; tomcat/src/doc/tomcat apache howto.html
; 1999 2000; 
Introduces the cooperation of Tomcat and Apache. Shows how to configure Apache and Tomcat. 
Also covers configuring Apache and Tomcat for multiple Tomcat JVM's, virtual hosting, and 
Gal Shachor; Working with mod_jk; tomcat/src/doc/mod_jk howto.html
; 1999 2000; 
Explains the installation and configuration of mod_jk more in depth than the article mentioned 
5.5.3  Prepared SQL Statements 
When the same SQL statement needs to be executed repeatedly, it is more efficient to use the 
PreparedStatement rather than the Statement command. Prepared statements are precompiled 
prior to being used, and accept any number of parameters. A simple example of how to use 
prepared statements in Java is given below. The PreparedStatement class is part of the SQL 
Package of the core Java 2 API. 
// Generate the SQL string
// To indicate a parameter, a question mark is used.
StringBuffer sql = new StringBuffer(256);
sql.append("INSERT INTO Users(Username, Password) ");
sql.append("VALUES(?, ?)");
// Create the prepared statement; assuming dbConn represents an existing
// database connection.
PreparedStatement stmt = dbConn.prepareStatement(sql.toString());
// Generate some random data to be put in the database
String[][] user = {
{ "johnt", "youllneverguessit" },
{ "garys", "topsecret" },
{ "eddym", "mybirthday" }};
// Execute the statement 3 times, after setting the parameters.
for (int i = 0; i < 3; i++)
for (int j = 0; j < 2; j++) stmt.setString(j+1, user[i][j]);

Java Web Hosting Application Development Using Java Technologies Hosting Business web hosting division of Vision Web Hosting Inc. All rights reserved.