The MysqldResource
class supports three
different constructor forms:
public MysqldResource(File baseDir, File dataDir,
String mysqlVersionString, PrintStream out, PrintStream
err, Utils util)
The most detailed constructor, enables you to set the base directory, data directory, select a server by its version string, standard out and standard error and MySQL utilities class.
public MysqldResource(File baseDir, File dataDir,
String mysqlVersionString, PrintStream out, PrintStream
err)
Enables you to set the base directory, data directory, select a server by its version string, standard out and standard error.
public MysqldResource(File baseDir, File dataDir,
String mysqlVersionString)
Enables you to set the base directory, data directory and select a server by its version string. Output for standard out and standard err are directed to System.out and System.err.
public MysqldResource(File baseDir, File dataDir)
Enables you to set the base directory and data directory. The default MySQL version is selected, and output for standard out and standard err are directed to System.out and System.err.
public MysqldResource(File baseDir);
Allows the setting of the "basedir" to deploy the MySQL files to. Output for standard out and standard err are directed to System.out and System.err.
public MysqldResource();
The basedir is defaulted to a subdirectory of the java.io.tempdir. Output for standard out and standard err are directed to System.out and System.err;
MysqldResource API includes the following methods:
void start(String threadName, Map
mysqldArgs);
Deploys and starts MySQL. The "threadName" string is used to name the thread which actually performs the execution of the MySQL command line. The map is the set of arguments and their values to be passed to the command line.
void shutdown();
Shuts down the MySQL instance managed by the MysqldResource object.
Map getServerOptions();
Returns a map of all the options and their current (or default, if not running) options available for the MySQL database.
boolean isRunning();
Returns true if the MySQL database is running.
boolean isReadyForConnections();
Returns true once the database reports that is ready for connections.
void setKillDelay(int millis);
The default “Kill Delay” is 30 seconds. This represents the amount of time to wait between the initial request to shutdown and issuing a “force kill” if the database has not shutdown by itself.
void addCompletionListenser(Runnable listener);
Allows for applications to be notified when the server process completes. Each ''listener'' will be fired off in its own thread.
String getVersion();
Returns the version of MySQL.
void setVersion(int MajorVersion, int
minorVersion, int patchLevel);
The standard distribution comes with only one version of MySQL packaged. However, it is possible to package multiple versions, and specify which version to use.
Ésta es una traducción del manual de referencia de MySQL, que puede encontrarse en dev.mysql.com. El manual de referencia original de MySQL está escrito en inglés, y esta traducción no necesariamente está tan actualizada como la versión original. Para cualquier sugerencia sobre la traducción y para señalar errores de cualquier tipo, no dude en dirigirse a mysql-es@vespito.com.