0

I have a java program which uses Mysql database(using mysql which comes with Xaamp). I ve written batch script to start xaamp and run java program. How can i make sure that my java program is executed only after xaamp is up and running after startup? Or is there any alternatives, my constraint is that I can only use Mysql which comes with xaamp and i want a database entry at windows startup?

3 Answers 3

4

Start both applications as windows services and configure the java app service to depend on the mysql service.

C:\Users\user>sc showsid "MySQL"

NAME: MySQL
SERVICE SID: S-1-5-80-3683700405-516785638-1234977990-1036077020-2941583457
STATUS: Inactive

C:\Users\user>sc showsid "MySQL" | FIND "STATUS:"
STATUS: Inactive
Sign up to request clarification or add additional context in comments.

Comments

0

You could check if MySQL is running by checking the port it's running on, usually 3306, and build a retry mechanism for that, say, check every 10 seconds?

Comments

0

add both of them to the task scheduler for WIN7 and cronjob in linux

hope it helps

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.