You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The method "isc_detach_database" is not being called in dispose of connections. This makes the process of Firebird (classic mode) is loaded into memory and is only released when the application terminates. Unfortunately we use the old Firebird 1.5, but probably this problem should occur in all versions.
Below is a snippet of code to bypass this problem:
using (var conn = new FbConnection("User=SYSDBA;Password=masterkey;Database=myserver:mydatabase.fdb;Dialect=3;Charset=WIN1252;"))
{
conn.Open();
DataTable dt = new DataTable();
new FbDataAdapter("SELECT FIRST 400 * FROM TABLE", conn).Fill(dt);
//Hack by reflection to FIX the close/dispose issue
var fbConnectionInternal = typeof\(FbConnection\)\.GetField\("innerConnection", BindingFlags\.NonPublic \| BindingFlags\.Instance\);
var innerConnection = fbConnectionInternal\.GetValue\(conn\);
var iDatabase = innerConnection\.GetType\(\)\.GetField\("db", BindingFlags\.NonPublic \| BindingFlags\.Instance\);
var db = iDatabase\.GetValue\(innerConnection\);
var detachMethod = db\.GetType\(\)\.GetMethod\("Detach"\);
detachMethod\.Invoke\(db, null\);
conn\.Close\(\);
}
Please can you fix this problem? Many problems are occurring in our servers because of this. Thanks in advance.
The text was updated successfully, but these errors were encountered:
That's very likely because you didn't turned off the connection pooling (at least not in the example above). Add into your connection string "Pooling=False" and see the difference.
Submitted by: Hélio Tibagí de Oliveira (chogoki)
The method "isc_detach_database" is not being called in dispose of connections. This makes the process of Firebird (classic mode) is loaded into memory and is only released when the application terminates. Unfortunately we use the old Firebird 1.5, but probably this problem should occur in all versions.
Below is a snippet of code to bypass this problem:
using (var conn = new FbConnection("User=SYSDBA;Password=masterkey;Database=myserver:mydatabase.fdb;Dialect=3;Charset=WIN1252;"))
{
conn.Open();
DataTable dt = new DataTable();
new FbDataAdapter("SELECT FIRST 400 * FROM TABLE", conn).Fill(dt);
}
Please can you fix this problem? Many problems are occurring in our servers because of this. Thanks in advance.
The text was updated successfully, but these errors were encountered: