Home All Groups Group Topic Archive Search About

what if the database connection isn't close

Author
27 Mar 2005 8:30 AM
Joe Abou Jaoude
I m assuming that there's a bug in a vb.net application, and in some
cases the connections to the database are not being closed. So what
happen ? will this cause some performance issues or does the garbage
collector close the connection while disposing the connection object ?

regards

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Author
27 Mar 2005 10:35 AM
Cor Ligthert
Joe,

I never heard about a bug of that however recomended is to close or when
there is connection pooling dispose your connection, when you don't know
that, just dispose. Dispose does close as well.

I hope this helps,

Cor
Author
27 Mar 2005 2:10 PM
OHM ( Terry Burns )
You must manually close the connection with  myConnection.close(), otherwise
the object will be released but the connection will stay open.

--
OHM ( Terry Burns )

http://TrainingOn.net





Show quoteHide quote
"Joe Abou Jaoude" <anonym***@devdex.com> wrote in message
news:%23Zx92cqMFHA.2704@TK2MSFTNGP15.phx.gbl...
>
>
> I m assuming that there's a bug in a vb.net application, and in some
> cases the connections to the database are not being closed. So what
> happen ? will this cause some performance issues or does the garbage
> collector close the connection while disposing the connection object ?
>
> regards
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!
Author
28 Mar 2005 1:59 PM
Joe Abou Jaoude
what i meant was a bug im my application...
let's say an exception is occuring after the connection is opened, thus
preventing the connection to be closed,would that be critical ?
in other words is it crucial to close the connection in the Finally
block like this:
try
   con.Open()
   'some code goes here
Catch ex as Exception
    Throw ex
Finally
   con.close()
End Catch

If i didn't close the connection in the finally block, and due to some
bugs the connection didn't close. So in this case, according to Terry
Burns the connection will stay open even after the object is released
bythe GC. So if many connection stayed opened, what would happen ? that
will affect the performance for connecting to the database? use more
memory ? use all the available connection in the pooling then produce an
error ????...

regards




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Author
28 Mar 2005 2:17 PM
Chris Dunaway
If I'm not mistaken, when the connection object is disposed, the
connection will be closed.
Author
28 Mar 2005 6:20 PM
Cor Ligthert
Joe,

The as long as you don't shut the power down will the finally be executes.

Cor