I just find this code and I use to check if MYSQL Server is running after every ten second...by call this method
public static boolean hostAvailabilityCheck(String address, int port) {
try (Socket s = new Socket(address, port)) {
return true;
} catch (IOException ex) {
/* ignore */
}
return false;
}
so do I do it right, or there is other better way for check for MYSQL if still running after some second? please help me.
The port can be open without any application listening to it. If you want to see also that your mySQL application is listening on the port, get mySQL connector for JAVA and look how to establish a connection - with user name and password.
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加