Documentation Home
MySQL Cluster API Developer Guide
Download this Manual
PDF (US Ltr) - 5.0Mb
PDF (A4) - 4.9Mb
EPUB - 1.9Mb
HTML Download (TGZ) - 1.9Mb
HTML Download (Zip) - 1.9Mb


MySQL Cluster API Developer Guide  /  ...  /  Getting, Installing, and Setting Up MySQL Cluster Connector for Java

4.2.1 Getting, Installing, and Setting Up MySQL Cluster Connector for Java

This section discusses how to obtain MySQL Cluster Connector for Java sources, binaries, compiling, installing, getting started.

Obtaining MySQL Cluster Connector for Java.  You can obtain the most recent MySQL Cluster NDB 7.1 or later source or binary release incorporating MySQL Cluster Connector for Java from downloads.mysql.com.

Building and installing MySQL Cluster Connector for Java from source.  You can build and install ClusterJ, ClusterJPA, or both as part of building and installing MySQL Cluster, which always requires you to configure the build using a --with-plugins option that causes NDB support to be included, such as --with-plugins=ndbcluster or --with-plugins=max. Other relevant plugin names that can be used with this option include the following:

  • clusterj: Required for building MySQL Cluster with ClusterJ support.

  • openjpa: Required for building MySQL Cluster with ClusterJPA support.

In addition, you should use the following two configure options when configuring a build to include ClusterJ, ClusterJPA, or both:

  • --with-classpath=path: Required for building MySQL Cluster with ClusterJPA support. path must include the path or paths to the OpenJPA libraries and OpenJPA dependencies on your system.

  • --with-extra-charsets: ClusterJ uses the ucs2 character set for internal storage, and ClusterJ cannot be built without it. The simplest way to ensure that this character set is available is to configure using --with-extra-charsets=all. This is what we recommend that you use, unless you have some reason for not wanting to include all character sets, in which case you should make sure that ucs2 is specified in the character set list passed to this option.

A typical configuration step in building MySQL Cluster with support for both ClusterJ and ClusterJPA might look like this:

shell> ./configure --with-plugins=ndbcluster,clusterj,openjpa \ 
  --with-extra-charsets=all  \ 
  --with-classpath=path/to/openjpa/libs \ 
  --prefix=path/to/install/directory 

path/to/openjpa/libs must include the following:

  • openjpa-2.2.2.jar

  • driver-5.1.10.jar (This is the MySQL JDBC driver)

  • geronimo-jta_1.1_spec-1.1.jar

  • geronimo-jpa_3.0_spec-1.0.jar

  • serp-1.13.1.jar

  • commons-lang-2.1.jar

  • commons-collections-3.2.jar

Note

Not all available options for configuring a MySQL Cluster build are shown in this section. For information about other options that can be used, see Installing MySQL Using a Development Source Tree, or consult the output of configure --help.

After configuring the build, run make and make install as you normally would to compile and install the MySQL Cluster software. Following installation, the MySQL Cluster Connector for Java jar files can be found in share/mysql/java under the MySQL installation directory (by default, this is /usr/local/mysql/share/mysql/java).

You can also use the included file storage/ndb/clusterj/pom.xml for building ClusterJ with Maven. Setting up your build environment to use Maven requires that you run mvn install in the clusterj directory. Assuming that you are already in the root directory of the MySQL Cluster source tree, you can accomplish this by performing in your shell the steps shown here:

cd storage/ndb/clusterj
mvn install
        

This causes ClusterJ—including the clusterj-jpa plugin—to be built, with the resulting .jar files installed in the local repository.

MySQL Cluster Connector for Java jar files.  After building and installing MySQL Cluster with MySQL Cluster Connector for Java, you should find the following JAR files that are needed for using ClusterJ and ClusterJPA in share/mysql/java/ under the MySQL Cluster installation directory:

  • clusterj-api.jar: This is the compile-time jar file, required for compiling ClusterJ application code.

  • clusterj.jar: This is the runtime library required for executing ClusterJ applications.

  • clusterjpa.jar: This is the runtime library required for executing ClusterJPA applications. This jar file must be in your classpath when running OpenJPA with ClusterJPA.


User Comments
Sign Up Login You must be logged in to post a comment.