Spec-Zone .ru
спецификации, руководства, описания, API

22.3.3.4. Installing from the Development Source Tree

Caution

Read this section only if you are interested in helping us test our new code. To just get MySQL Connector/J up and running on your system, use a standard binary release distribution.

To install MySQL Connector/J from the development source tree, make sure that you have the following prerequisites:

To check out and compile a specific branch of MySQL Connector/J, follow these steps:

  1. Check out the latest code from the branch that you want with one of the following commands.

    The source code repository for MySQL Connector/J is located on Launchpad at https://code.launchpad.net/connectorj. To check out the latest development branch, use:

    shell> bzr branch
                        lp:connectorji

    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 creates a 5.1 subdirectory in the current directory containing the latest 5.1 code.

  2. 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_HOME environment variable to the path of the older JDK installation.

  3. Change your current working directory to either the connectorj or 5.1 directory, depending on which branch you intend to build.

  4. To build Connector/J 5.1, edit the build.xml to 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 -D option.

  5. 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
  6. 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 22.3.3.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