HP OSMS Blueprint: Database Server on HP Server Platforms with MySQL and RHEL5
The RHEL5 distribution also contains MySQL connectors to enable Perl, Python, and PHP, but
they are outside the scope of this document. Table 7 lists the MySQL connectors that are available
as part of the HP Open Source Middleware Database Server Stack.
Table 7 Available MySQL Connectors
Included?NotesDescriptionConnector Name
YesNone
Standard connector for accessing MySQL
from Java applications, including the JBoss
and Tomcat application servers.
Connector/J
YesNone
Connector for Microsoft .NET applications
to use a MySQL database.
Connector/.NET
Yes
UNIX version available
but not recommended.
Windows only. Allows applications such as
Excel to retrieve data from MySQL.
Connector/ODBC
No
Not supported by
MySQL.
Connects PHP/Perl/Python applications to
a MySQL database. Key component of
LAMP stack.
Connector/PHP, Perl
and Python
No
Targeted at embedded
databases.
Java wrapper for database.Connector/MXJ
JDBC Connector (Connector/J)
The Java Database Connectivity (JDBC) technology is a Java API that lets you invoke SQL
commands to create database tables, access the data stored in a table, and create and manage
distributed transactions. It is the standard tool for enabling Java access to MySQL and can be
used for application servers, such as Tomcat or JBoss, or from standalone Java applications.
For more information about JDBC technology, see the JDBC Technology Code Samples web page
located at:
http://java.sun.com/developer/codesamples/jdbc.html
Connecting with Tomcat
In this section, you create a sample web application to connect with the database. The application
is deployed in Tomcat. You can download Tomcat at:
http://tomcat.apache.org/download-55.cgi
You can also download Tomcat documentation at:
http://tomcat.apache.org/tomcat-5.5-doc/index.html
1. Create a sample database on the MySQL server using the instructions in “Creating the
Sample Database for MySQL” (page 15).
2. Download the MySQL JDBC driver from the official website located at:
http://dev.mysql.com/downloads/connector/j/5.0.html
3. Install the MySQL JDBC driver to the application server by uncompressing and copying the
JDBC JAR file to the Tomcat library directory using the following commands. ($TOMCAT is
the Tomcat installation path.)
# tar zxf mysql-connector-java-<version>.tar.gz
# cp mysql-connector-java-<version>-.jar $CATALINA_HOME/common/lib
4. Build a web application directory structure under Tomcat by entering the following
commands:
# mkdir $TOMCAT/webapps/osmsexample
# mkdir $TOMCAT/webapps/osmsexample/META-INF
# mkdir $TOMCAT/webapps/osmsexample/WEB-INF
Connecting External Systems to the MySQL Database 33