Re: ADO.Net Connection Pooling Problem with Oracle



Matthew,

I do have a development environment, but why would I want to use OLEDB
which I thought added another layer to the data access interface? I'm
trying to solve the problem with the OracleClient.

When I turn off connection pooling, then the database gets overloaded
with database connections as soon as people start accessing the
application. I don't think .Net releases the connections until the
garbage collector cleans them up. I've experimented with this and
that's essentially what I saw. See the 2nd last paragraph of my
original message.

Moving connOracle.close up to the try section of the try block does
nothing different. The finally part of the try block always gets
executed whether there is an exception or not unless the exception is
within the code within the finally section.

This code is in production.

Can anyone give an example of a pooled database connection's life
cycle? I haven't read anything that tells me what causes a connection
to be put into the pool and when does a connection get taken from the
pool. Is the connection immediately put into the pool upon executing
the .close method of the connection object or does it wait until after
the connection object is cleaned up by the garbage collector? Does .Net
always get a pooled connection if one exists for the same connection
string or are there exceptions? How does Oracle interact with .Net?
Does .Net pool just one connection for each unique connection string or
does it do something similar to what OLEDB did in ADO 2.5-2.6, where it
creates n+nbr processors connections?

If .Net will not use connections that have been closed but have not
been garbage collected, then what the hell good is pooling? Or should I
be collecting garbage everytime I close a database connection? Isn't
garbage collection an intensive process, hence the reason it runs in
the background? Problem with calling System.GC.Collect() explicitly is
that I'm open multiple connections for each web page that's loaded. I
have a data access component that returns datasets and closes the
connections beforehand so I don't have to worry about closing
connections on the calling side.

Thanks,
Bird

.



Relevant Pages

  • Re: Need explanation on calling Close() from finalizer.
    ... > finalizers, whatever they are called). ... and let the garbage collector call the finalizer ... > to do cleanup when they go out of scope. ... Suppose you've got a connection pool of 10 connections. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: htmlfile ActiveX very abscure problem (not the usual disconnect problem)
    ... The basic problem was with the Garbage Collector. ... //set up the activex object appropriately. ... the GC timeout in place the stream never gets up and running.. ... connection a live for long periods is to add this line of code to the ...
    (alt.html)
  • Re: Very quick question: Whats the difference between Close() and Dispose()?
    ... Closecloses the connection and returns it to the pool, ... in memory until the garbage collector decides it can destroy it - Dispose ... When Closeis called (or Dispose() by virtue of what it does) the ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Question about memory and DB connections
    ... Calling Close (or Dispose) on an open connection object closes the ... even if the garbage collector frees up the memory used by the ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Reusing Parameters
    ... I always close my connections and dispose of my objects after I have used ... but at least it's marked and the Garbage Collector ... connection object, if it's not closed, I close it then dispose of it. ... >> Dim conn As SqlClient.SqlConnection ...
    (microsoft.public.sqlserver.programming)