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 binary release distribution.
To install MySQL Connector/J from the development source tree, make sure that you have the following prerequisites:
A Bazaar client, to check out the sources from our Launchpad repository (available from http://bazaar-vcs.org/).
Apache Ant version 1.7 or newer (available from http://ant.apache.org/).
JDK 1.4.2 or later. Although MySQL Connector/J can be be used with older JDKs, to compile it from source you must have at least JDK 1.4.2. If you are building Connector/J 5.1 you will need JDK 1.6.x and an older JDK such as JDK 1.5.x. You will then need to point your JAVA_HOME environment variable at the older installation.
The source code repository for MySQL Connector/J is located on Launchpad at https://code.launchpad.net/connectorj.
To check out and compile a specific branch of MySQL Connector/J, follow these steps:
Check out the latest code from the branch that you want with one of the following commands.
To check out the latest development branch use:
shell> bzr branch lp:connectorj
This creates a connectorj
subdirectory
in the current directory that contains the latest sources
for the requested branch.
To check out the latest 5.1 code use:
shell> bzr branch lp:connectorj/5.1
This will create a 5.1
subdirectory in
the current directory containing the latest 5.1 code.
If you are building Connector/J 5.1 make sure that you have both JDK 1.6.x installed and an older JDK such as JDK 1.5.x. This is because Connector/J supports both JDBC 3.0 (which was prior to JDK 1.6.x) and JDBC 4.0. Set your JAVA_HOME environment variable to the path of the older JDK installation.
Change location to either the
connectorj
or 5.1
directory, depending on which branch you want to build, to
make it your current working directory. For example:
shell> cd connectorj
If you are building Connector/J 5.1 you need to edit the
build.xml
to reflect the location of
your JDK 1.6.x installation. The lines that you need to
change are:
<property name="com.mysql.jdbc.java6.javac" value="C:\jvms\jdk1.6.0\bin\javac.exe" /> <property name="com.mysql.jdbc.java6.rtjar" value="C:\jvms\jdk1.6.0\jre\lib\rt.jar" />
Alternatively, you can set the value of these property names
through the Ant -D
option.
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 20.3.2.2, “Installing the Driver and Configuring the CLASSPATH
”.
A package containing both the binary and source code for Connector/J 5.1 can also be found at the following location: Connector/J 5.1 Download
User Comments
Add your own comment.