Firebird connection pools never close connections idle for a long time

G

Gen

Hello there,

I am developing a web application using Firebird.NET provider ver 1.7
Connection pooling is being used to better the application's performance.

The problem is that the pool never closes its connections, even if they are
being idle for a long time.
Is there some way to make the pool automatically release a connection if not
being used for a certain period of time?
I don't want to use the "Connection Lifetime" property of the connection
string, because it is related to the connection's Close() method only.

Thank you in advance
 
G

Guest

I am not familiar with the Firebird ADO.NET provider, but if it follows the
ADO.NET model which you can be reasonably sure it does, then you should only
need to Close your connection when you are done with your work and it will be
returned to the connection pool. Be advised that connection pools are based
on the connection string, so it should be the same in order to cut down on
getting a new pool for each connection (not what you want).
Peter
 
G

Gen

Thank you for your post Peter,

The problem is not a missing call to the Close() method of the connection -
infact the source code concerning database operations is capsulated in my
custom class named DB and exposing static methods like Extract(params),
Execute(params), Exists(params), etc. and each of them follows the following
pattern:

public static Method(params_1)
{
using (DB db=new DB(params_2)) {
// method source code
}
}

The Dispose() method of DB explicitly closes the connection to tha database

So the problem is that even when working correctly with the connection when
it returned to the pool it is never disposed of - it remaines active and the
database always has at least 1 user connected to it (while currently noone
is working with it)

The workaround I managed to find is the following implementation in the
global.asax.cs file:

protected void Session_End(Object sender, EventArgs e)
{
FirebirdSql.Data.Firebird.FbConnection.ClearAllPools();
}

At least when a user's session expires all connection pools (if more than
one) will be triggered for clean up
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top