Database Reference
In-Depth Information
I recommend installing the driver in the lib directory. That gives it the most global
visibility (accessible by Tomcat and by applications), and you need install it only once.
If you enable the driver only for the mcb application by placing a copy in mcb/WEB-
INF/lib , but then develop other applications that use MySQL, you must either copy the
driver into those applications or move it to a more global location.
Making the driver more globally accessible also is useful if you think that at some point
you may elect to use JDBC-based session management (see Recipe 21.4 ) or realm au‐
thentication. Those activities are handled by Tomcat itself above the application level,
so Tomcat needs access to the driver to carry them out.
After installing Connector/J, restart Tomcat. Then request the following mcb application
page to verify that Tomcat can find and use Connector/J:
http://localhost:8080/mcb/jdbc_test.jsp
You might need to modify jdbc_test.jsp to change the connection parameters.
Installing the JSTL distribution
Many of the scripts that are part of the mcb sample application use JSTL, a popular tag
library. It's necessary to install JSTL or those scripts won't work. To install a tag library
into an application context, copy the library's JAR file or files into the application's WEB-
INF/lib directory. The following instructions describe how to install JSTL for use with
the mcb application:
1. Make sure that the mcb.war file has been unpacked to create the mcb application
directory hierarchy under the Tomcat webapps directory. (Refer back to “Installing
the mcb application.”) The JSTL files must be installed under the mcb directory,
which does not exist until mcb.war has been unpacked.
2. Get JSTL from the Apache Standard Taglibs project page , which has a download
link from which you can get a binary JSTL distribution. Get version 1.1.2 or higher.
3. Unpack the JSTL distribution into some convenient location, preferably outside of
the Tomcat hierarchy. If you use a ZIP archive, you can unpack it with the jar utility
or any other program that understands ZIP format (such as the Windows Win‐
Zip application). For example, with jar , use the following command, adjusting the
filename as necessary:
% jar xf jakarta-taglibs-standard.zip
4. Unpacking the distribution creates a directory containing several directories and
files. Change location into the lib directory and copy the jstl.jar and standard.jar
JAR files to the mcb/WEB-INF/lib directory. Those files contain the classes that
implement the JSTL tag actions, and tag library descriptor files that define the in‐
terface for the actions implemented by the classes.
Search WWH ::




Custom Search