To create a custom Connector/MXJ package that includes a
specific mysqld version or platform, extract
and rebuild the mysql-connector-mxj.jar
(Connector/MXJ v5.0.3 or earlier) or
mysql-connector-mxj-gpl-[ver]-db-files.jar
(Connector/MXJ v5.0.4 or later) file.
First, create a new directory into which you can extract the
current connector-mxj.jar:
shell> mkdir custom-mxj shell> cd custom-mxj shell> jar -xf connector-mxj.jar shell> ls 5-0-22/ ConnectorMXJObjectTestExample.class ConnectorMXJUrlTestExample.class META-INF/ TestDb.class com/ kill.exe
If you are using Connector/MXJ v5.0.4 or later, unpack the
connector-mxj-db-files.jar:
shell> mkdir custom-mxj shell> cd custom-mxj shell> jar -xf connector-mxj-db-files.jar shell> ls 5-0-51a/ META-INF/ connector-mxj.properties
The MySQL version directory, 5-0-22 or
5-0-51a in the preceding examples, contains
all of the files used to create an instance of MySQL when
Connector/MXJ is executed. All of the files in this directory
are required for each version of MySQL to embed. Note as well
the format of the version number, which uses hyphens instead of
periods to separate the version number components.
Within the version specific directory are the platform specific
directories, and archives of the data and
share directory required by MySQL for the
various platforms. For example, here is the listing for the
default Connector/MXJ package:
shell>> ls Linux-i386/ META-INF/ Mac_OS_X-ppc/ SunOS-sparc/ Win-x86/ com/ data_dir.jar share_dir.jar win_share_dir.jar
Platform specific directories are listed by their OS and
platform - for example the mysqld for Mac OS
X PowerPC is located within the
Mac_OS_X-ppc directory. You can delete
directories from this location that you do not require, and add
new directories for additional platforms that you intend to
support.
To add a platform specific mysqld, create a
new directory with the corresponding name for your operating
system/platform. For example, you could add a directory for Mac
OS X/Intel using the directory
Mac_OS_X-i386.
On Unix systems, you can determine the platform using
uname:
shell> uname -p i386
In Connector/MXJ v5.0.9 and later, an additional
platform-map.properties file is used to
associate a specific platform and operating system combination
with the directory in which the mysqld for
that combination is located. The determined operating system and
platform are on the left, and the directory name where the
appropriate mysqld is located is on the right. You can see a
sample of the file below:
Linux-i386=Linux-i386
Linux-x86=Linux-i386
Linux-i686=Linux-i386
Linux-x86_64=Linux-i386
Linux-ia64=Linux-i386
#Linux-ppc=Linux-ppc
#Linux-ppc64=Linux-ppc
Mac_OS_X-i386=Mac_OS_X-i386
Mac_OS_X-ppc=Mac_OS_X-ppc
Rhapsody-PowerPC=Mac_OS_X-ppc
#Mac_OS-PowerPC=
#macos-PowerPC=
#MacOS-PowerPC=
SunOS-sparc=SunOS-sparc
Solaris-sparc=SunOS-sparc
SunOS-x86=SunOS-x86
Solaris-x86=SunOS-x86
FreeBSD-x86=FreeBSD-x86
Windows_Vista-x86=Win-x86
Windows_2003-x86=Win-x86
Windows_XP-x86=Win-x86
Windows_2000-x86=Win-x86
Windows_NT-x86=Win-x86
Windows_NT_(unknown)-x86=Win-x86
Now download or compile mysqld for the MySQL
version and platform you want to include in your custom
connector-mxj.jar package into the new
directory.
Create a file called version.txt in the
OS/platform directory you have just created that contains the
version string/path of the mysqld binary. For example:
mysql-5.0.22-osx10.3-i386/bin/mysqld
You can now recreate the connector-mxj.jar
file with the added mysqld:
shell> cd custom-mxj shell> jar -cf ../connector-mxj.jar *
For Connector/MXJ v5.0.4 and later, repackage to the
connector-mxj-db-files.jar:
shell> cd custom-mxj shell> jar -cf ../mysql-connector-mxj-gpl-[ver]-db-files.jar *
Test this package using the steps outlined in Section 4.3, “Connector/MXJ Quick Start Guide”.
Because the
mysql-connector-mxj-gpl-[ver]-db-files.jar
file is separate from the main Connector/MXJ classes you can
distribute different
mysql-connector-mxj-gpl-[ver]-db-files.jar
files to different hosts or for different projects without
having to create a completely new main
mysql-connector-mxj-gpl-[ver].jar file
for each one.

User Comments
Add your own comment.