Re: Database Connections Not Dropping with Pooling=false
Posted by: Darren Gulliver
Date: June 13, 2016 02:40AM

Good Morning,

I'm still having issues with our mySQL database not dropping the connections eventhough pooling = false is set in the ASP.NET connection string.

I tried this piece of code on a Windows Forms application which is taken from our ASP.NET application.

Connection String = server=www.****.co.uk;user id=****; password=****; database=********; pooling=false; port=3306;Convert Zero Datetime=True;

Dim myCmd = New MySqlCommand("SELECT * FROM tblVoucherDisplay WHERE VD_FORM_NUMBER='' ", conn5)
myCmd.Connection.Open()
myCmd.ExecuteReader()
myCmd.Connection.Close()
myCmd.Connection.Dispose()

I put a break point on myCmd.Connection.Close(), checked mysql and could see my connection. Let the rest of the code run and the connection disappeared.

I removed pooling=false repeated the same steps but this time my connection remained.

I reinstated pooling=false and changed my code to utilse the Using statement:
Using conn5 As New MySqlConnection(GBTFConnection.GBTFConnectionString)
Dim myCmd = New MySqlCommand("SELECT * FROM tblVoucherDisplay WHERE VD_FORM_NUMBER='' ", conn5)
myCmd.Connection.Open()
End Using

And as expected connections disconnected.

Are there any other factors that I could be missing?

Thanks
Darren

Options: ReplyQuote


Subject
Written By
Posted
Re: Database Connections Not Dropping with Pooling=false
June 13, 2016 02:40AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.