How to implement Exchange as monitoring the availability of internal SQL Server

We have an internal application ( Thick Client ) that relies on our central SQL server. The application is a desktop application that allows users to work in the "Offline" mode (for example, Outlook). What I need to do is a way to pinpoint whether SQL is available or not.

What I still have:

I am currently using the following method →

 internal static void CheckSQLAvailability()
    {
        using (TcpClient tcpc = new TcpClient())
        {
            try
            {
                tcpc.Connect(Settings.Default.LiveSQLServer, Settings.Default.LiveSQLServerPort);
                IsSQLAvailable = true;                    
            }
            catch
            {
                IsSQLAvailable = false;
            }
        }
    }

I am not crazy about this approach for the following reasons.

  • Providing false negatives
  • Requires " manually " called
  • Seems "smelly" (try / catch)

X (3??) , , , , .

, SQL- :

  • 1

, , ? " ".

P.S. : CRUD-, SQL- SQLExpress. , Sync, DAL User.Setting. , , . . NetworkChangeDetection, , , , SQL-.

+5
1

, Windows SQL Server: (SELECT @@version). , SQL , . - "" , , - .

TCP drawbaks, :

  • -TCP-, (LPC) (SMB)
  • TCP-, , , ( SQL )
  • , , , SQL Server ( IO, , .. ..).

, SQL Server , ", , - ?". ( " " ), , , : , SQL Express, , , Service Broker , - API .

+5

All Articles