You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by lightbulb432 <ve...@hotmail.com> on 2007/02/19 04:09:20 UTC

Open database connection from Ant

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.
-- 
View this message in context: http://www.nabble.com/Open-database-connection-from-Ant-tf3250704.html#a9036614
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Open database connection from Ant

Posted by Steve Loughran <st...@apache.org>.
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: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Open database connection from Ant

Posted by lightbulb432 <ve...@hotmail.com>.
Sounds interesting, but how can I do this with Ant? Beginner, remember...? 
:)



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: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Open-database-connection-from-Ant-tf3250704.html#a9088709
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Open database connection from Ant

Posted by Steve Loughran <st...@apache.org>.
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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Open database connection from Ant

Posted by Kevin Jackson <fo...@gmail.com>.
>
> I should have changed my question from "open a connection to a database" to
> "start the database server"...that seems more like it.
>

Try sshexec if your server is a remote machine (of course it needs to
be running sshd)

Kev

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Open database connection from Ant

Posted by lightbulb432 <ve...@hotmail.com>.
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.
> 

-- 
View this message in context: http://www.nabble.com/Open-database-connection-from-Ant-tf3250704.html#a9036622
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org