How to shutdown + restart MySQL from Java?

M

Mark Sizzler

How can shutdown and/or restart MySQL database from inside Java?

Is there a library for that?

Mark
 
R

Roedy Green

How can shutdown and/or restart MySQL database from inside Java?

Is there a library for that?

you can always use exec.
see http://mindprod.com/jgloss/exec.html
--
Roedy Green Canadian Mind Products
http://mindprod.com
"Humanity is conducting an unintended, uncontrolled, globally pervasive experiment
whose ultimate consequences could be second only to global nuclear war."
~ Environment Canada (The Canadian equivalent of the EPA on global warming)
 
X

Xo/\\mC

Hi Mark,
I have found the MySQL Connector/MXJ at http://dev.mysql.com/doc/refman/5.0/en/connector-mxj.html


"MySQL Connector/MXJ is a Java Utility package for deploying and
managing a MySQL database. Deploying and using MySQL can be as easy as
adding an additional parameter to the JDBC connection url, which will
result in the database being started when the first connection is
made. This makes it easy for Java developers to deploy applications
which require a database by reducing installation barriers for their
end-users.

MySQL Connector/MXJ makes the MySQL database appear to be a java-based
component. It does this by determining what platform the system is
running on, selecting the appropriate binary, and launching the
executable. It will also optionally deploy an initial database, with
any specified parameters. "

Hope it will be useful for you.

Xo/\mC
 
T

timjowers

How can shutdown and/or restart MySQL database from inside Java?

Is there a library for that?

Mark                                    

Did you find one? Maybe you could make one. You can, of course,
integrate with the command line calls with a ProcessBuilder.
http://www.serviza.com/javabook/C33.htm

/etc/init.d/mysqld stop
service "Mysql ..." stop

Unix/Linux standardized on the command line interface for service
management so you can call "status", "start", "stop" etc. Windows dos
have a ServiceControlManager (think that is the name) C functions you
could abstract. Tomcat and others have Java classes to call and
control them.

Maybe you could make some way to control services remotely too. That'd
be nice. Not sure if such a thing exists already for Linux.
 
A

Arne Vajhøj

Mark said:
How can shutdown and/or restart MySQL database from inside Java?

Is there a library for that?

I don't think so.

There are no SQL command for shutting down MySQL (and
obviously none to start it).

Runtime.exec seems as the only way.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top