Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / October 2003

Tip: Looking for answers? Try searching our database.

newbie: check if mysql server is running

Thread view: 
Johan - 03 Oct 2003 19:37 GMT
Hi,

I'm trying to figure out how to check wether or not the mysql server is
up and running with my java program, and if not start the mysql server.
I've succeeded in connecting to the server, so thats not the problem.
I've looked at various tutorials and information about mysql and JDBC,
but I didn't find the answer. Maybe one of You can help.

thanks in advance, Johan
Lothar Kimmeringer - 03 Oct 2003 20:04 GMT
> I'm trying to figure out how to check wether or not the mysql server is
> up and running with my java program, and if not start the mysql server.

Open the socket to the remote-port of MySQL. If it's not throwing
an exception, it's up.

Regards, Lothar
Signature

Lothar Kimmeringer                E-Mail: spamfang@kimmeringer.de
              PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
                questions!

Johan - 03 Oct 2003 20:13 GMT
>>I'm trying to figure out how to check wether or not the mysql server is
>>up and running with my java program, and if not start the mysql server.
>
> Open the socket to the remote-port of MySQL. If it's not throwing
> an exception, it's up.

Thanks for Your reply, but sorry this is maybe simple stuff,
unfortunately not for me :-(
How can I do this (or where can I find information about this subject?)
When there is an exception how do I start the server with my program
(e.g. not with the console or mysqladmin)
Thanks Johan

> Regards, Lothar
Lothar Kimmeringer - 03 Oct 2003 21:09 GMT
>>>I'm trying to figure out how to check wether or not the mysql server is
>>>up and running with my java program, and if not start the mysql server.
[quoted text clipped - 5 lines]
> unfortunately not for me :-(
> How can I do this (or where can I find information about this subject?)

What subject in detail? Opening sockets?
http://java.sun.com/j2se/1.4.2/docs/api/java/net/Socket.html
Starting a process from Java?
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html#exec(java.lang.String)
or others dependent on the environment-variables that might
be necessary to be set.

> When there is an exception how do I start the server with my program
> (e.g. not with the console or mysqladmin)

In the bin-directory there should be something like mysqld.
Dependent on the operating-system you're running on a
/etc/rc.d/mysql start
does everything for you.

Maybe another database fits better for your needs. Without knowing
more (my crystal-ball is quite inaccurate these days due to
the little distance of mars to earth) maybe

http://mckoi.com/database/

is something for you.

Regards, Lothar
Signature

Lothar Kimmeringer                E-Mail: spamfang@kimmeringer.de
              PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
                questions!



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.