Java Reference
In-Depth Information
L ISTING 7.11
Continued
pool.releaseConnection(con);
}
out.println(“</body></html>”);
out.close();
}
//Get Servlet information
public String getServletInfo() {
return “TitleListGlobalPooledServlet Information”;
}
}
To see how your new servlet works, load the following URL into your browser:
http://yourserver/djs/servlet/TitleListGlobalPooledServlet
Summary
This chapter covered the basics of the JDBC. I discussed setting up the JDBC-ODBC Bridge
and how to load JDBC drivers. You took a look at the most common SQL statements and how
to execute them using the JDBC. You then merged the JDBC with the servlets and performed
some basic queries.
Finally, you looked at some ways to optimize the use of JDBC in servlets. You did this by
using a connection pool and inter-servlet communications.
At this point, you should be able to create your own servlet that can access a database using
either a straight JDBC connection or a connection pool. You should understand how to create
and execute basic SQL statements. You should also understand and be able to use the
ServletContext for inter-servlet communications.
In the next chapter we will take a look at JavaMail and how we can incorporate JavaMail into
servlets.
 
Search WWH ::




Custom Search