To include a pre-configured/populated database within your
Connector/MXJ JAR file you must create a custom
data_dir.jar
file, as included within the
main connector-mxj.jar
(Connector/MXJ 5.0.3
or earlier) or
mysql-connector-mxj-gpl-[ver]-db-files.jar
(Connector/MXJ 5.0.4 or later) file:
First extract the
connector-mxj.jar
ormysql-connector-gpl-[ver]-db-files.jar
file, as outlined in the previous section (see Section 22.4.6.1, “Creating your own Connector/MXJ Package”).First, create your database and populate the database with the information you require in an existing instance of MySQL - including Connector/MXJ instances. Data file formats are compatible across platforms.
Shutdown the instance of MySQL.
Create a JAR file of the data directory and databases that you want to include your Connector/MXJ package. You should include the
mysql
database, which includes user authentication information, in addition to the specific databases you want to include. For example, to create a JAR of themysql
andmxjtest
databases:shell> jar -cf ../data_dir.jar mysql mxjtest
For Connector/MXJ 5.0.3 or earlier, copy the
data_dir.jar
file into the extractedconnector-mxj.jar
directory, and then create an archive forconnector-mxj.jar
.For Connector/MXJ 5.0.4 or later, copy the
data_dir.jar
file into the extractedmysql-connector-mxj-gpl-[ver]-db-files.jar
directory, and then create an archive formysql-connector-mxj-db-gpl-[ver]--files.jar
.
Note that if you are create databases using the InnoDB engine,
you must include the ibdata.*
and
ib_logfile*
files within the
data_dir.jar
archive.