Re: ODP .Net Connection Pool Problem on Web Application
- From: "Mario Pareja" <mpareja.dev@xxxxxxxxx>
- Date: 14 Feb 2006 07:19:16 -0800
I have seen a very similar issue come up when using SQL connection and
leaving them open. It is possible that only one connection in your
code fails to close the connection, but if that piece of code is
executed several times over, you will receive this error.
I have run into this problem when using data readers for fetching SQL
records. Any time you open a connection or use a data reader, it must
be followed by a Close call. Interestingly enough, I was occasionally
still receiving errors of the sort. I determined the error to be
caused by exceptions thrown while in the midst of a connection; I now
wrap any data reader connection as follows:
SqlDataReader dr = null;
try {
// SQLHelper - Microsoft Data access App.
dr = SQLHelper.ExecuteReader (....);
while (dr.Read ()) {
_myStrings.Add (dr.GetString(0));
_myInt.Add (dr.GetInt32(1));
}
dr.Close();
}
catch {
dr.Close ();
throw;
}
In some cases, I will simply put a finally block that has the
dr.Close() in it, but only if I don't care to re-throw the exception.
Anyway, I recommend you ensure anywhere you open a connection, you
close it. .NET does not close them when the object goes out of scope.
.
- Follow-Ups:
- References:
- ODP .Net Connection Pool Problem on Web Application
- From: mingki
- ODP .Net Connection Pool Problem on Web Application
- Prev by Date: ExecuteReader closed connection
- Next by Date: Syntax error?
- Previous by thread: Re: ODP .Net Connection Pool Problem on Web Application
- Next by thread: Re: ODP .Net Connection Pool Problem on Web Application
- Index(es):
Relevant Pages
|