How do I verify that a remote MySQL server is valid and exists

1k views Asked by At

I have a VB6 application which allows a user to enter the remote server name manually. I need to use the server name provided by the user to connect to a MySQL database.

How can I check whether the server that the user entered is valid and that I can connect to it?

1

There are 1 answers

0
Deanna On

The only reliable way to see if it is valid and that you can connect to it is to try and connect to it. Anything else will cause a potential race condition (it became invalid between the check and actual use) or have the possibility of incorrect results, as you wouldn't be checking what you actually want to do.