To demonstrate how to build a JDBC servlet, I will use a simple example to illustrate the basic servlet framework. All servlets are built by extending a basic servlet class and defining Java methods to deal with incoming client requests. In a JDBC servlet, this is typically where database connections are made and other one-time expensive processes are initiated. After initialization, servlets are capable of handling many requests through a single servlet instance. Each client request generates one service call.
Service calls can be concurrent.
Once the servlet has been successfully compiled, you are ready to move it to an executable directory under the Web server root. This directory is usually called servlet . JDBC URLs provide a unique way of identifying databases. In this example, the driver is odbc, and the database is an ODBC datasource named testdata . The other two getConnection parameters are user nam e and password .