[dba-VB] Close DB Connection

jwcolby jwcolby at colbyconsulting.com
Tue Nov 30 07:46:49 CST 2010


I had a similar issue with connections to SQL Server.  When I was investigating the problem I 
discovered that (in my case) the issue was that the garbage collector (GC) was taking its sweet time 
collecting the trash, and the connections were not released until the trash was taken out.

Understand that in my case I was creating classes which created a collection, then I would destroy 
the class.  Since the GC does its thing whenever it decides that it needs to free up memory, and 
since I had a lot of memory, the GC decided to take its sweet time.

Once I discovered destructors and dispose, my problems went away.

John W. Colby
www.ColbyConsulting.com

On 11/30/2010 8:06 AM, ACTEBS wrote:
> Hi Everyone,
>
>
>
> I've got this issue with my app where the app keeps it's connection to the
> Access DB open even after the application has finished it's task. I can't
> figure out for the life of me where I've missed closing it in the various
> Functions and Sub Routines.
>
>
>
> I've ensured that cn.Close and cn = Nothing, has been included in all the
> code where the DB is opened. The only place I can't include cn = Nothing is
> when the connection is encapsulated within a Using Statement where for some
> reason this is not allowed. Could this be the problem? If so, how can I
> release the connection?
>
>
>
> Also, is there any way of finding out which bit of code is keeping the
> connection open?
>
>
>
> Many Thanks
>
>
>
> Vlad
>
>
>
>
>
>
>
> _______________________________________________
> dba-VB mailing list
> dba-VB at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-vb
> http://www.databaseadvisors.com
>
>



More information about the dba-VB mailing list