且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何关闭与 firebird 数据库的连接

更新时间:2023-02-02 20:44:48

Firebird .NET 提供程序有一个内置的连接池,默认情况下它是启用的.您可以将 Pooling=false 添加到连接字符串以禁用它.但是,在很多情况下,连接池是一件好事(它可以节省必须打开连接的时间),因此请确保您确实需要禁用它.

The Firebird .NET provider has a built-in connection pool and it is enabled by default. You can add Pooling=false to the connection string to disable it. However in a lot of cases a connection pool is a good thing (it saves the time of having to open a connection), so make sure you really need to disable it.

调用 FbConnection.ClearPool(connection)FbConnection.ClearAllPools() 应该关闭池中当前打开的连接.

Calling FbConnection.ClearPool(connection) or FbConnection.ClearAllPools() should close currently open connections in the pool.

还要确保在查询MON$ATTACHMENTS 时开始一个新事务.监控表的内容在单个事务中冻结".

Also make sure you start a new transaction when querying MON$ATTACHMENTS. The content of monitoring tables is 'frozen' inside a single transaction.