26.3.2.3. Installing from the Development Source Tree
Caution
You should read this section only if you are interested in
helping us test our new code. If you just want to get MySQL
Connector/J up and running on your system, you should use a
standard release distribution.
To install MySQL Connector/J from the development source tree,
make sure that you have the following prerequisites:
Subversion, to check out the sources from our repository
(available from
https://subversion.tigris.org/).
Apache Ant version 1.6 or newer (available from
https://ant.apache.org/).
JDK-1.4.2 or later. Although MySQL Connector/J can be
installed on older JDKs, to compile it from source you must
have at least JDK-1.4.2.
The Subversion source code repository for MySQL Connector/J is
located at
https://svn.mysql.com/svnpublic/connector-j. In
general, you should not check out the entire repository because
it contains every branch and tag for MySQL Connector/J and is
quite large.
To check out and compile a specific branch of MySQL Connector/J,
follow these steps:
-
At the time of this writing, there are three active branches
of Connector/J: branch_3_0
,
branch_3_1
and
branch_5_0
. Check out the latest code
from the branch that you want with the following command
(replacing [major]
and
[minor]
with appropriate version
numbers):
shell> svn co https://svn.mysql.com/svnpublic/connector-j/branches/branch_[major]
_[minor]
/connector-j
This creates a connector-j
subdirectory
in the current directory that contains the latest sources
for the requested branch.
-
Change location to the connector-j
directory to make it your current working directory:
shell> cd connector-j
-
Issue the following command to compile the driver and create
a .jar
file suitable for installation:
shell> ant dist
This creates a build
directory in the
current directory, where all build output will go. A
directory is created in the build
directory that includes the version number of the sources
you are building from. This directory contains the sources,
compiled .class
files, and a
.jar
file suitable for deployment. For
other possible targets, including ones that will create a
fully packaged distribution, issue the following command:
shell> ant --projecthelp
-
A newly created .jar
file containing
the JDBC driver will be placed in the directory
build/mysql-connector-java-[version]
.
Install the newly created JDBC driver as you would a binary
.jar
file that you download from MySQL
by following the instructions in
Section 26.3.2.1.3, “Installing the Driver and Configuring the CLASSPATH
”.