Check if server exists
- by buhtla
Here is the problem. User can enter server name and connection string for database.
If server is not accessible (wrong address, firewalls or any other issue), I want to be aware of this as quickly as possible.
If I'm using sqlConnection and try to connect to a non-accessible server this takes very long (I think more than 1 minute!). This has nothing to do with connection timeout btw so setting this property won't help.
My idea is to first try to ping server and if I get response (which means server is accessible from the point of application), than proceed with sqlConnection. If there is no response from ping, operation is aborted and user is properly notified.
Is there any better way of doing this? Any idea would be welcome.