Too many connections, Express 6.50.228

Too many connections, Express 6.50.228

Postby alfvaen » Fri 04 Nov 2011 19:17

We're running into an odd problem trying to convert some old code (C#, .NET 2.0, with Corelab 3.55.26) to .NET 4.0 with dotConnect for MySQL Express 6.50.228. In general it seems to work fine, but one particular query causes a lot of connections to come up on the server and then fail with "Too many connections".

This query is one that our code needs to use frequently--we have two backend tables, one of which contains current data and the other of which is being loaded with new data, and another table, df_loadtable, which keeps track of which table has the current data. As such, it only contains two records and is very small.

The query is this:

SELECT Load_Table, Last_Load FROM df_loadtable WHERE test = 1

Connection string is very plain: "Data Source=...; Database=...; User ID=...; Password=...".

Our code opens a new MySqlConnection (conn) in a using(...) block, then creates a command. The using block contains the following code:

MySqlCommand command = new MySqlCommand();
command.Connection = conn;
command.CommandType = CommandType.text;
command.CommandText = sql;
object rtnObj = command.ExecuteScalar();

It seems that every time this code is run, it creates a new connection rather than using one in the existing pool. I tried adding "pooling=false;" to the connection string, and it didn't have any effect. I added "max pool size=10;" instead, and it only made the problem happen more slowly. When I comment out the entire function call and return a constant, I don't get the problem. When I stop the process that contains the code, the connections disappear immediately.

Is there a workaround for this issue, some other set of connection parameters I can try? Let me know if you need more information.

ETA: Back-end database server is running MySql 5.5.11, which is the most recent version that still works with our version of Corelab...

Aaron V. Humphrey
Web Developer
Posts: 2
Joined: Tue 11 Oct 2011 17:58

Postby Pinturiccio » Tue 08 Nov 2011 07:48

If you use "pooling=false" then connections will not use a pool of connections. "Max pool size = 100" by default. Decreasing the value of max pool size you can slow down your application.
We can not reproduce the issue. Can you send us the script of your database and the code of the function that invoke the issue.
Devart Team
Posts: 1953
Joined: Wed 02 Nov 2011 09:44

Return to dotConnect for MySQL