Running within a Java Object


To "embed" a MariaDB database within a Java application, use the com.mysql.management.MysqldResource class directly. This class may be instantiated with the default (no argument) constructor, or by passing in a java.io.File object representing the directory into which to unzip the server. It may also be instantiated with printstreams for stdout and stderr for logging.

Once instantiated, a java.util.Map, the object will be able to provide a java.util.Map of server options appropriate for the platform and version of MariaDB which you will be using.

The MysqldResource enables you to 'start' MariaDB with a java.util.Map of server options which you provide, as well as 'shutdown' the database. The following example shows a simplistic way to embed MariaDB in an application using plain java objects.

You can find this file in the Connector/MXJ package as src/ConnectorMXJObjectTestExample.java.

Retornar