number of connections made to a database

  • Hi 

    I am having sql 2000 as well as sql 2005 database setup.

    i have  Applications which are connecting to the databases

    I want to know how to monitor the number of connections made to the data base.

    Kindly provide some advice

    Thanks in advance

  • I have no idea if this will work for 2005 :

     

    Select * from master.dbo.sysperfinfo where counter_name = 'User connections'

     

    EDIT 8000

  • For 2005 you can use this to get what you're looking for

    Select * from sys.dm_exec_sessions

  • hi

    Thank you for your answer.

    I have one more query on the same.

    My applications are spilt across many paths ie path1 path2 path3 etc ..

    Basically you can think of it as many applications of the same kind querrying the database.

    i need to monitor how many connections from each path are made to the database

    Please help

    Thanks

    Anu

     

  • Does the application tell the server which 'path' it's using, or is coming from?

    Or is there some other way you can identify that 'path'?

    If there is, then that is the info you want to look for.

    If not, I guess you won't know, right?

    /Kenneth

  • In the connection string you can set an application name, which you can retrieve from sql server (when doing auditing in a trigger or SP).  But I don't know if stats are kept per application.

     

    Why do you need to do this exactly?

  • Just thaught of another way :

    Set the application name in the connection string.

     

    Then fire up the profiler with the trace of active connections only.  Save the results to a table and then you'll be able to report on a per application basis.

  • "Select * from master.dbo.sysperfinfo where counter_name = 'User connections'"

    this only works for Window NT 4.0 & doesn't give any connection info.

  • Thanx for letting me know.  Do you know any other alternative than my trace idea?

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply