Subject Re: [firebird-support] UserNames connected to my database
Author Helen Borrie
At 11:25 p.m. 28/07/2015, blumy2005@... [firebird-support] wrote:

>Hi. I have a problem. I use a Firebird 1.5.6 Server for a lot of applications, 5 databases on the same server.
>I need to find the number of connection for a single database, and the names of the users. For this i used IBX IBDatabaseInfo->UserNames->Count and IBDatabaseInfo->UserNames->Strings[i], in Builder C++.
>The problem is if i have started a lot of application, the number of connections is the TOTAL connections to the SERVER, not only for my database. I have only one connection to my TIBDatabase, but IBDatabaseInfo->UserNames->Count report 3, with 2 connection to another application, different database!!!
>Give my a valid solution to find only UserNames connected to my database!!!

Can't be done in v.1.5, sorry. Firebird users connect to the server, then the server connects them to a database. You could make a log table in each database that records logins and logouts.

From v.2.1, you have the MON$ATTACHMENTS table that you can query. It works only with databases of ODS 11.1.

Coming in Firebird 3 is the ability to have a dedicated security database for each database - even to embed a security database inside a user database.

Helen Borrie, Support Consultant, IBPhoenix (Pacific)
Author of "The Firebird Book" and "The Firebird Book Second Edition"