I'm testing a quite old Delphi 6 application and would like to display the database name the TSqlConnection is actually connected to, so I can see quickly if I'm connected to the test or production database.
In sqlconnections.ini, the app has a connection named 'Vienna' to a Firebird database defined like this: Database=192.168.1.15:ProductionDB (it's an alias) and I've replaced that for testing purposes with Database=192.168.1.15:TestDB.
But I've seen that just accessing the TSqlConnection's Params-List and there the value of 'Database' does not work. This value is always set the same as it is in design mode.
How can I find out which database (which Firebird alias in my case) the TSqlConnection is actually connected to?
When
SQLConnection.Params
property is emptyParams.Values['Database']
return empty string even whenBeforeConnect
orAfterConnect
events is fired .You can use TSQLConnection.OnLogin event. For example :
Source
monitoring tables were introduced into FB 2.1.x :-)
So try
Or try
See info at