Installing from the Development Source Tree
To install MariaDB 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 MariaDB Connector/J can be be used with older JDKs, compiling it from source requires at least JDK 1.4.2. To build Connector/J 5.1 requires JDK 1.6.x and an older JDK such as JDK 1.5.x; point your
JAVA_HOMEenvironment variable at the older installation.
To check out and compile a specific branch of MariaDB Connector/J, follow these steps:
- Check out the latest code from the branch that you want with one of the following commands.
The source code repository for MariaDB Connector/J is located on Launchpad at https://code.launchpad.net/connectorj. To check out the latest development branch, use:
shell>
bzr branch lp:connectorjiThis creates a
connectorjsubdirectory 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.1This creates a
5.1subdirectory in the current directory containing the latest 5.1 code. - To build 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_HOMEenvironment variable to the path of the older JDK installation. - Change your current working directory to either the
connectorjor5.1directory, depending on which branch you intend to build. - To build Connector/J 5.1, edit the
build.xmlto reflect the location of your JDK 1.6.x installation. The lines 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
-Doption. - Issue the following command to compile the driver and create a
.jarfile suitable for installation:shell>
ant distThis creates a
builddirectory in the current directory, where all build output will go. A directory is created in thebuilddirectory that includes the version number of the sources you are building from. This directory contains the sources, compiled.classfiles, and a.jarfile 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
.jarfile containing the JDBC driver will be placed in the directorybuild/mysql-connector-java-.[version]Install the newly created JDBC driver as you would a binary
.jarfile that you download from MySQL, by following the instructions in , "Installing the Driver and Configuring theCLASSPATH".
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