Compiling Connector/J ===================== Connector/J 5.1 supports both JDBC 3 and JDBC 4+ with a single code base. This requires JDBC 3 classes to be compiled with Java 5 and JDBC 4+ to be compiled with Java 8. The variables 'com.mysql.jdbc.jdk5' and 'com.mysql.jdbc.jdk8' are used to find the respective compilers when building the driver. Side by side with these, the variable 'com.mysql.jdbc.extra.libs' must point to the location of third-party libraries that we don't distribute and are required for compiling. Compiling all JDBC 4+ code with Java 8 alone produces some warnings since JDBC 4.0 and JDBC 4.1 classes don't require a compliler higher than Java 6. To get more precise results and avoid warnings use the property 'com.mysql.jdbc.jre6.rtjar' to point to the Java 6 'rt.jar' library (usually in 'jre/lib/rt.jar'). Further details can be found in http://dev.mysql.com/doc/connector-j/en/connector-j-installing-source.html. Targets: "dist", "full-dist", "package", "full-package", "full-package-no-sources", "compile", "install" Testing Connector/J =================== Connector/J 5.1 ships with an extensive test suite that can be run simply by providing a MySQL JDBC URL in the variable 'com.mysql.jdbc.testsuite.url' and by calling the target "test". If nothing more is set, these tests run with the JVMs referred in the variables 'com.mysql.jdbc.jdk5' and 'com.mysql.jdbc.jdk8' for JDBC 3 and JDBC 4+ related tests respectively. Alternatively, all tests can be run with a single JVM, provided that it is pointed out in the variable 'com.mysql.jdbc.testsuite.jvm'. Running the full test suite with different JVMs and different MySQL servers at once is also possible. The variables 'com.mysql.jdbc.testsuite.jvm' and 'com.mysql.jdbc.testsuite.url' can be suffixed with an index ".1" to ".9" to indicate the multiple alternatives which results in the matrix of all possible combinations. The target "test-multijvm" must be called in this case. Running only one test set is possible by setting the variable 'test' with the class' fully qualified name. If also a comma separated list of test names is provided in the variable 'methods', then only these will be executed. Targets: "test", "test-multijvm" Compliance ========== This file ships with targets for these matters. Further details can be found in the respective targets. Coverage and instrumentation ============================ This file ships with target "test-coverage" for collecting coverage results and "report-coverage" for creating the HTML coverage report. The JCov library needed to run these targets can be found at http://hg.openjdk.java.net/code-tools/jcov, it's JARs should be placed into ${com.mysql.jdbc.extra.libs}/jcov directory. The "test-coverage" target instruments classes using JCov, runs tests collecting coverage info into result file set as ${com.mysql.jdbc.coverage.result.dir}/${com.mysql.jdbc.coverage.result.name}. The "report-coverage" target first merges coverage result files which full paths are passed via 'com.mysql.jdbc.coverage.merge.files' property into file which path is passed via 'com.mysql.jdbc.coverage.merge.result' property, then builds the HTML report from 'com.mysql.jdbc.coverage.merge.result' file into the directory passed via 'com.mysql.jdbc.coverage.report.dir' property. If some properties are not passed to ANT script then default values are used: com.mysql.jdbc.coverage.result.dir - "${buildDir}/coverage" com.mysql.jdbc.coverage.result.name - "result.xml" com.mysql.jdbc.coverage.merge.files - none, merge step is skipped com.mysql.jdbc.coverage.merge.result - ${com.mysql.jdbc.coverage.result.dir}/result.xml com.mysql.jdbc.coverage.report.dir - ${com.mysql.jdbc.coverage.result.dir}/report Targets: "test-coverage", "report-coverage" MySQL Fabric support and testing ================================ Support for MySQL Fabric connections is seamlessly included in Connector/J, so when the driver is compiled it already includes all the required classes for it. Testing MySQL Fabric support can be done by setting specific variables and running the respective targets. Further details can be found in the last targets in this file. Sample 'build.properties' that can be used to compile, build, test and test with multi JVMs =========================================================================================== ~~~start cut here~~~ # Basic settings for 'compile', 'test', 'test-multijvm' and targets that depend on these. # External libraries needed for both compiling and testing: # - Further details in http://dev.mysql.com/doc/connector-j/en/connector-j-installing-source.html # - Mandatory. com.mysql.jdbc.extra.libs=<full_path_to_connector-j-jardeps> # JDKs needed for compiling: # - Must point to JDK home directories. # - Also used for testing if 'com.mysql.jdbc.testsuite.jvm' is not provided. # - Mandatory. com.mysql.jdbc.jdk5=<full_path_to_jdk1.5> com.mysql.jdbc.jdk8=<full_path_to_jdk1.8> # Java 6 runtime libraries for compiling JDBC 4.0 and JDBC 4.1 classes: # - Must point to the library 'jre/lib/rt.jar'. # - Optional. If not provided, Java 8 runtime is used in its place. com.mysql.jdbc.jre6.rtjar=<full_path_to_jre1.6/lib/rt.jar> # Single JVM/MySQL tests: # - Must point to JDK or JRE home directories. # - If not provided, JDBC 3 tests are run with 'com.mysql.jdbc.jdk5'. # - If not provided or pointing to a Java5 JVM, JDBC 4+(<4.2) tests are run with 'com.mysql.jdbc.jdk8'. # - If not provided or pointing to a JVM lower than 8, JDBC 4.2 tests are run with 'com.mysql.jdbc.jdk8'. # - Optional. com.mysql.jdbc.testsuite.jvm=<full_path_to_a_jdk_or_jre> # - URL to the test database. # - Any of the current MySQL versions. # - Mandatory for 'test' target. com.mysql.jdbc.testsuite.url=jdbc:mysql://<host>:<port>/<testDB>?user=<user>&password=<pwd> # Multiple JVM/MySQL tests: # - Must point to JDK or JRE home directories. # - If pointing to a Java5 JVM, JDBC 4+(<4.2) tests are run with 'com.mysql.jdbc.jdk8' instead. # - If pointing to a JVM lower than 8, JDBC 4.2 tests are run with 'com.mysql.jdbc.jdk8'. # - Mandatory (at least one, at most eight) for 'test-multijdk' target. com.mysql.jdbc.testsuite.jvm.1=<full_path_to_a_jdk_or_jre> com.mysql.jdbc.testsuite.jvm.2=<full_path_to_a_jdk_or_jre> com.mysql.jdbc.testsuite.jvm.3=<full_path_to_a_jdk_or_jre> # - URL to the test database(s). # - Any of the current MySQL versions. # - Mandatory (at least one, at most eight) for 'test-multijdk' target. com.mysql.jdbc.testsuite.url.1=jdbc:mysql://<host1>:<port1>/<testDB1>?user=<user1>&password=<pwd1> com.mysql.jdbc.testsuite.url.2=jdbc:mysql://<host2>:<port2>/<testDB2>?user=<user2>&password=<pwd2> # Cancels re-compiling between successive test executions. # - Implicit in multiple JVM/MySQL in between iterations. # - Comment variable if not needed. # - Optional. com.mysql.jdbc.noCleanBetweenCompiles=yes # Other targets may require specific settings. Check 'build.xml' for details. ~~~end cut here~~~ Removing sources from '${toPackage}' Compiling MySQL Connector/J JDBC 3 implementation with '${com.mysql.jdbc.jdk5}' to '${compiler.output}' Compiling MySQL Connector/J JDBC 4+ implementation with '${com.mysql.jdbc.jdk8}' to '${compiler.output}' Compiling MySQL Connector/J testsuite with '${com.mysql.jdbc.jdk5}' to '${compiler.output}' Compiling MySQL Connector/J-c3p0 integration with '${com.mysql.jdbc.jdk5}' to '${compiler.output}' Compiling MySQL Connector/J-jboss integration with '${com.mysql.jdbc.jdk5}' to '${compiler.output}' Compiling MySQL Connector/J-log4j integration with '${com.mysql.jdbc.jdk5}' to '${compiler.output}' ${test.message.jdbc3orcommon} ${test.message.jdbc4} ${test.message.jdbc42} ${test.message.dontfail} Running compliance test suite against '${com.mysql.jdbc.compliance.url.final}' with jvm '${com.mysql.jdbc3.testsuite.jvm.java}' ${test.message.dontfail}