Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Number of users logged in

Status
Not open for further replies.

zemp

Programmer
Jan 27, 2002
3,301
0
0
CA
How can you check how many users are logged into a Pervasive database?

Hopefully a list of users and how they are logged in (which application).

Pervasive 8.6

zemp
 
Use the Pervasive Monitor (W3MONV75.EXE). It's in the Active Users (MKDE) and Active Connections(SRDE).

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
Custom VB and Btrieve development.
 
I got the following to work through VB using DTO objects.
Code:
Private Function Check_UserNumber() As Integer
'// Check the number of app users in the database.
   Dim result As dtoResult
   Dim dtoSess As DtoSession
   Dim SessMonitor As DtoMonitor
   Dim Clients As DtoSQLClients
   Dim SingleCl As DtoSQLClient
   Dim i As Integer

   Set dtoSess = New DtoSession
   result = dtoSess.Connect("<MyServer>", "", "")
   If result = Dto_Success Then
      Set SessMonitor = dtoSess.Monitor
      Set Clients = SessMonitor.SQLClients
      For i = 1 To Clients.Count
         Set SingleCl = Clients(i)
         If Trim$(SingleCl.AppDesc) = App.Title Then
            Check_UserNumber = Check_UserNumber + 1
         End If
         Set SingleCl = Nothing
      Next i
      Set Clients = Nothing
      Set SessMonitor = Nothing
   End If
   dtoSess.Disconnect
   Set dtoSess = Nothing
End Function
The main drawback is that you need a server name and /or user name and password. My app accesses the database mainly via ADO and I don't necessarilly have access to this information. The users might not either.

Is there any way that I could create a stored procedure so that I could check this through ADO?

zemp
 
Nope.. Not through a Stored Procedure or DTO. You should be able to get it through your ADO connection. Use the COnnection String or read the DSN information.


Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
Custom VB and Btrieve development.
 
I'll look into it the ADO connection further. Any other insights are appreiciated.

zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top