db query Servlet: opening the db
import javax.servlet.http.*;
import java.sql.*; // JDBC needs this
public class SimpleInq extends HttpServlet {
private static Connection con = null; // used by JDBC
private static Statement stmt = null; // used by JDBC
public void init (ServletConfig config) throws ServletException {
connectJdbc(); // registers the JDBC and opens the database
The init method is called only the first time the Servlet is invoked into memory, so there are no concurrency issues.
Author | Title | Track | Home