Skip to content

Instantly share code, notes, and snippets.

@fredgdaley2
Last active August 24, 2017 14:10
Show Gist options
  • Save fredgdaley2/08626d78604717c5bd7df3edf92b6191 to your computer and use it in GitHub Desktop.
Save fredgdaley2/08626d78604717c5bd7df3edf92b6191 to your computer and use it in GitHub Desktop.
Check if an MySQL server is alive.
Imports MySql.Data.MySqlClient
Public Function IsMySqlServerAvailable(ByVal dbCnxStr As String) As Boolean
Try
Using srvrConnection = New MySqlConnection(dbCnxStr)
Try
srvrConnection.Open()
Return True
Catch ex As MySqlException
Return False
End Try
End Using
Catch ex as ArgumentException
Return False;
End Try
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment