Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2002
    Posts
    3

    Unanswered: How can I get the mssqlserver status ?

    How can I get the sql server/msde running status?
    [Running/Stopping/Stopped/...]?

    API OpenSCManager/OpenService...?
    But it seems these function does not work in win98?
    And I don;t want to use DMO or WMI

    And how can I know whether a specified database is currently in use?

    Please help me ,thank you

  2. #2
    Join Date
    Oct 2002
    Posts
    369

    Re: How can I get the mssqlserver status ?

    Q1 How can I get the sql server/msde running status?Running/Stopping/Stopped/...?

    Q2 And how can I know whether a specified database is currently in use?
    A1 On NT 3.x, 4.x, Win 2k, XP, and later one may poll for a list of currently running services e.g.(Net start). On Win Me, 9x and below generally there is not a service implementation per se (generally one would need to poll running processes).

    A2 One may check the dbname column of the result set returned by:

    exec sp_Who

  3. #3
    Join Date
    Dec 2002
    Posts
    3

    Re: How can I get the mssqlserver status ?

    thank you

  4. #4
    Join Date
    Feb 2002
    Posts
    2,232
    You can use the SQL-SCM api (however, conflicting documentation exists that it does not work for 2000 even though it is documentated with 2000). Also, you can use the scm.exe utility.

  5. #5
    Join Date
    Dec 2002
    Posts
    3
    Originally posted by rnealejr
    You can use the SQL-SCM api (however, conflicting documentation exists that it does not work for 2000 even though it is documentated with 2000). Also, you can use the scm.exe utility.

    Hello,rnealejr
    thank you for your reply

    My database is MSDE, I want to find some API that can work under both 2000 and 98.Could you please tell me the API and dll?(I don't want DMO or WMI).I can know SQLServer whether is running through scm -action 3. But how can I get return state in program?


    Thank you again

  6. #6
    Join Date
    Feb 2002
    Posts
    2,232
    I believe the dll is named W95scm.dll under the binn directory. There is a header file and library file as well. Which version of sql server are you using ?

  7. #7
    Join Date
    Oct 2002
    Posts
    369
    Scm.exe (and the related API) should be easier and more direct to use to ascertain the DBMS operational state. For some reason, I didn't think about the service control manager, (I'm not sure scm supports Sql Server 6.x and earlier installs, but that is not an issue using MSDE).

Posting Permissions

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