Page 1 of 1

discover number of active connections [SOLVED]

Posted: Tue 23 Sep 2014 12:55
by petersen
we need to discover the number of active connections to a database but the database has no "mon$" tables available and every client connects with the same user name.

so neither a "select * from MON$ATTACHMENTS" nor "TIBCConnection.DatabaseInfo.UserNames.Count" will work here.

we tried to make an api call on "isc_database_info()", using the handle of a "TIBCConnection" but didn't get this to work.

do you have any suggestion how to resolve this?

thanks in advance

Re: discover number of active connections

Posted: Wed 24 Sep 2014 09:14
by ViktorV
When retrieving the TIBCConnection.DatabaseInfo.UserNames property value, IBDAC uses an API function isc_database_info with a parameter isc_info_user_names. So you can use this property to retrieve the number of active connections to the database.

Re: discover number of active connections

Posted: Wed 24 Sep 2014 09:33
by petersen
but "TIBCConnection.DatabaseInfo.UserNames.Count" will be "1" - even if there are a lot more connections established with the same user-name (f.i. 100 connections with "SYSDBA"), right?

Re: discover number of active connections

Posted: Wed 24 Sep 2014 10:39
by ViktorV
As we wrote above, when retrieving the TIBCConnection.DatabaseInfo.UserNames property value, IBDAC uses an API function isc_database_info with a parameter isc_info_user_names.
You can refer to the Firebird documentation to learn how this API function works.

Re: discover number of active connections

Posted: Wed 24 Sep 2014 13:06
by petersen
looks like we have this problem (multiple connections active but only a single entry for a username) with ibdac under xe5?!

SELECT COUNT(*) FROM MON$ATTACHMENTS WHERE MON$USER = 'SYSDBA';
-> 3

TIBCConnection.DatabaseInfo.UserNames.CommaText
-> SYSDBA,SYSDBA,SYSDBA (XE, IBDAC 4.6.12)
-> SYSDBA,SYSDBA,SYSDBA (XE, IBDAC 5.4.10)
but
-> SYSDBA (XE5, IBDAC 5.3.9)
-> SYSDBA (XE5, IBDAC 5.4.10)

any suggestions?

Re: discover number of active connections

Posted: Wed 24 Sep 2014 14:58
by petersen
we finaly found the problem:

on the xe5 machine we installed the firebird-server with the "-classic -multithreaded" switches! after changing to "-superserver", "TIBCConnection.DatabaseInfo.UserNames.Count" shows the correct number of connections

Re: discover number of active connections [SOLVED]

Posted: Thu 25 Sep 2014 05:28
by ViktorV
It is good to see that the problem has been solved. If any questions concerning our products come up, please contact us.