This is by design. It "freezes" because it's scanning the network looking for the database server. If it's not found then it returns false
, but that can take some time.
There are other options for verifying the server, like this one here. You'll need to use the SqlConnectionStringBuilder
to parse the connection string and get the DataSource
. Armed with that information you can run that command and grab its response. You'll need to redirect the standard output though and then parse the output. In short, not really a very good option.