|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
what if the database connection isn't closeI 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! 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 You must manually close the connection with myConnection.close(), otherwise
the object will be released but the connection will stay open. 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! 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! If I'm not mistaken, when the connection object is disposed, the
connection will be closed. Joe,
The as long as you don't shut the power down will the finally be executes. Cor
Locate MessageBox over Window
Error with Custom Control Closing form... spice the boring default winforms treeview appearance up a bit... Help with SendMessage API calls Friend WithEvents MaskedEdit Control Object reference not set to an instance of an object. Upload file programmatically DataGrid OnPaint/? -How Do I Draw A GDI Type Circle On Top Of A DataGrid |
|||||||||||||||||||||||