Results 1 to 3 of 3

Thread: How to check if SQL Server is running on local server and remote server?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474

    How to check if SQL Server is running on local server and remote server?

    I can think of these ways:
    1- checking services with servicecontroller class: Not promising as you dont know the instance name on target machine
    2- Enumerating services and check for any service that starts with MSSQLSERVER
    3- Trying to connect to it. but to what database? master database? Can someone remove master database from the sql server? still no good cause it takes a long time for an exception to be thrown in case it can not connect.
    4- Connecting to the specific port of SQL server. No good cause you may run sql server on another port or another serivce listens on that port

    For local server second way seems good and for remote server the third way.

    Whats your idea?
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    No idea?
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    I believe you can use the SQLDMO Component (COM) to find instances of SQL Server. There may also be an API way.

    I haven't tried either of these yet but there is a big long thread over at vbCity on using the SQLDMO method:

    http://www.vbcity.com/forums/topic.asp?tid=5537

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width