且构网

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

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

更新时间:2023-02-02 21:01:25

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.