Re: How to deploy a custom database with MXJ
Eric Herman <[email protected]>
| Newsgroups | gmane.comp.db.mysql.java |
|---|---|
| Message-ID | <1150739068.2934.24.camel@localhost> |
Hello Hermann,
On Sun, 2006-06-18 at 15:23 +0200, Hermann Matthes wrote:
> Hello all,
> thanks for your great work on Connector/MXJ.
Thank you for the compliment.
It's great to hear of more people interested in deploying a MySQL
database with their Java applications.
> I have two questions on its usage:
>
> 1. Is there a way to deploy a custom database (with predefined tables,
> probably filled with some config records, probably with custom database
> users) when I deploy a java application, which uses MySQL with
> Connector/MXJ ?
With MySQL, when we create a new database, a subdirectory for that
database is created in the "data" directory. With each table creation,
files are created in that subdirectory.
To deploy our own custom "myappdb" database pre-configured with initial
data, we may wish to package up that sub-directory and add it to the
Connector/MXJ package.
Inside the connector-mxj.jar file is a "data_dir.jar" file. The
"data_dir.jar" contains an initial "data" directory with the "mysql" sub
directory (with mysql system tables) and an empty "test" directory (for
any tables which you wish to create in the "test" database).
We may freely add to the "data_dir.jar" a "myappdb" directory along with
the MySQL database files required for that database.
If we do not wish to alter the connector-mxj.jar file, we might consider
having some code which checks to see if the database exists, and if not,
creates the application database and loads the initial data via standard
JDBC.
> 2. How can I determine the installation directory of my deployed
> application to be able to set up the database directory ?
>
Do you mean the location in the file system from where the java command
was invoked? The "working directory"?
File workingDir = new File(System.getProperty("user.dir"));
> Thanks in advance
Our pleasure.
> Hermann
>
Cheers,
- Eric
--
Eric Herman, Software Developer
MySQL AB, www.mysql.com
Mobile: +1 206 913 8942
Are you MySQL certified? www.mysql.com/certification
--
MySQL Java Mailing List
For list archives: http://lists.mysql.com/java
To unsubscribe: http://lists.mysql.com/[email protected]