lightbulb432 wrote:
Sounds interesting, but how can I do this with Ant? Beginner, remember...? :)

Whcih platform are you running? Windows or Unix?




Steve Loughran wrote:
lightbulb432 wrote:
I should have changed my question from "open a connection to a database"
to
"start the database server"...that seems more like it.



lightbulb432 wrote:
How can I open a connection to a database from Ant? I have an Ant build
that builds and deploys an EAR file to an application server, but then I
have to separately start up the database server (MySQL) from the command
line the first time I deploy my app after restarting my computer.

Is there a way to start the database server (but only if it isn't
already
running) from within Ant?

Thanks.


there's a big difference here with platform.

win32 you can run a NET START mysqld , but be warned that if you set failonerror=true you get an error back if the service was already running. the SC command may be better.

Linux, well, whoever is root can run /etc/init.d/mysqld start, or you use <exec> to set up the database. If the port is already in use mysqld doesnt run.

I am currently fixing up the smartfrog component to bring up mysqld on linux; it is surprisingly hard to do it robustly, in a way that can be admined and shut down properly, *while not root*. A normal mysql installation is all set to run from root, so I have to override it all and set everything up so that the pid gets saved somewhere for the other apps to remember. Even on Java5 and 6, there's no obvious way to get a PID back from a running process. Anyway, its coming together and should be in the next release, along with the stuff to run jboss.

You may want to look at cargo, cargo.codehaus.org, to see what they have for db setup.

rereading your post, it looks like you just want mysqld to come up on restart. If this is windows, make the service automatic in the computer manager console, on linux add the symlink to start mysqld in runlevel 5, stop it on the way out, or use your distro's gui tools to do this for you.

-steve

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to