Java Reference
In-Depth Information
As indicated by point 1 above, we need the services of a Java-aware Web
application server in order to make use of the DataSource interface. The server used
here (and in later chapters) is Tomcat , a very popular open source server originally
developed by the Apache Software Foundation's Jakarta project and controlled
directly by Apache since the Jakarta project was retired on 21st December 2011.
Apache Tomcat is also the servlet container that is used in the offi cial Reference
Implementation for the Java Servlet and JavaServer Pages technologies (as covered
in the next two chapters).
The steps required to obtain a free download of the latest version of Tomcat, to
install this server and to start and stop it are given in Sect. 8.2 of the next chapter.
In order to understand fully the material in the current section, the reader must
have some familiarity with servlets. If the reader does not have such familiarity,
then he/she is advised to read the following chapter before continuing with the
present section.
Tomcat includes a Database Connection Pool (DBCP) connection broker. DBCP
is part of the Apache commons sub-project (previously the Jakarta commons sub-
project). Apache commons can be found at
http://commons.apache.org/ . In order to
use DBCP from within Tomcat, the following two fi les must be downloaded into
folder <CATALINA_HOME>\lib (previously <CATALINA_HOME>\common\lib ,
but folder commons no longer exists):
￿
commons-dbcp-(1.4).jar
￿
commons-dbcp-(1.4)-sources.jar.
The brackets above are not any part of the fi le names, of course, but indicate ver-
sion numbers that may be different in future. Remember that CATALINA_HOME is
the Tomcat root directory. The steps required to download these two fi les are given
below.
1. Go to http://commons.apache.org/ .
2. In the left-hand frame, click on the link Releases , under the heading 'Releases'.
3. Click on DBCP link in the 'Downloads' list.
4. Under the 'Binaries' heading for the latest version of the DBCP (1.4, at the time
of writing), click on:
commons-dbcp-
−bin.zip
(E.g., commons-dbcp-1.4-bin.zip )
<
Version no.
>
5. Using WinZip (or some other suitable utility), extract your zip fi le to <CATALINA_
HOME>\lib . The documentation fi le commons-dbcp-(1.4)-javadoc.jar will also
be extracted, along with the two main fi les.
Since DBCP uses JNDI (Java Naming and Directory Interface), it is necessary to
confi gure the JNDI data source before it can be used. (If you are unfamiliar with
JNDI, then don't be concerned. You won't really need to know anything about it in
order to follow the material in this section.) Three steps are required in order to
Search WWH ::




Custom Search