I have a Windows Service that intermittently checks for the existence of data files. When a file is found it updates a database with the data in the file. This application runs continuously. When I recently upgraded to the current version of dotConnect for MySQL my application began to run out of connections and fail. The connections are not closed and are not made available in a pool.
The vb.net code that is executed when I update the database is:
Dim myConnection As New MySqlConnection(connString)
MyTest = 2
Dim myCommand As New MySqlCommand(QueryString, myConnection)
MyTest = 3
myCommand.CommandType = CommandType.Text
MyTest = 4
myConnection.Open()
MyTest = 5
myCommand.ExecuteNonQuery()
myCommand.Dispose()
myConnection.Close()
myConnection.Dispose()
myConnection = Nothing
In spite of closing and disposing of the connection, the connection remains active for days at a time, only closing when I stop and restart my service.
The connection string looks like this:
Server=www.xyz.com; uid=xxx; pwd=yyy; database=zzz; Connection Lifetime=300;
Thanks,
Art
Connections not closing
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
Please specify the exact version of dotConnect for MySQL that you are using and, if possible, send us a test project. We couldn't reproduce the problem on the 5.70.120 build.
As a workaround, you may try setting the "Connection Lifetime" property to 0. In this case, inactive connections should be always returned to pool.
As a workaround, you may try setting the "Connection Lifetime" property to 0. In this case, inactive connections should be always returned to pool.