问题描述
我正在测试一个相当老的Delphi 6应用程序,并且想显示TSqlConnection实际连接到的数据库名称,因此我可以快速查看是否连接到测试或生产数据库。
在sqlconnections.ini中,应用程序具有一个名为 Vienna的连接到如下定义的Firebird数据库:
Database = 192.168.1.15:ProductionDB(这是别名)
,为了测试目的,我将其替换为
Database = 192.168.1.15:TestDB。
但是我已经看到仅访问TSqlConnection的参数-List,数据库的值不起作用。此值始终设置为与设计模式下相同。
如何找出TSqlConnection实际连接到哪个数据库(在我的情况下为哪个Firebird别名) ?
监视表已引入FB 2.1.x:-)
所以尝试
从MON $ DATABASE
中选择MON $ DATABASE_NAME pre>
或尝试
从MON $ ATTACHMENTS中选择MON $ ATTACHMENT_NAME
,其中MON $ ATTACHMENT_ID = CURRENT_CONNECTION
查看信息
- c:\Program Files(x86)\Firebird\Firebird_2_1\doc\README.monitoring_tables.txt
- 通过www 。 translate.ru
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 withDatabase=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?
monitoring tables were introduced into FB 2.1.x :-)
So try
select MON$DATABASE_NAME from MON$DATABASE
Or try
select MON$ATTACHMENT_NAME from MON$ATTACHMENTS
where MON$ATTACHMENT_ID = CURRENT_CONNECTION
See info at
- c:\Program Files (x86)\Firebird\Firebird_2_1\doc\README.monitoring_tables.txt
- http://firebirdsql.su/doku.php?id=mon_database via www.translate.ru
- https://dba.stackexchange.com/questions/29919/firebird-monitoring-tables
- http://www.upscene.com/documentation/fbtm2/index.html?dm_monitoringtables.htm
- http://www.firebirdsql.org/file/community/conference-2014/pcisar/#1
这篇关于如何获得DBExpress TSqlConnection实际连接到的数据库的名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!