如何验证远程 MySQL 服务器是否有效且存在
我有一个 VB6 应用程序,它允许用户手动输入远程服务器名称。我需要使用用户提供的服务器名称来连接到 MySQL 数据库。
如何检查用户输入的服务器是否有效并且可以连接到它?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看它是否有效以及是否可以连接到它的唯一可靠方法是尝试连接到它。其他任何事情都会导致潜在的竞争条件(它在检查和实际使用之间变得无效)或有可能出现不正确的结果,因为您不会检查您真正想做的事情。
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.