-1

It often happens that when trying to load the data from the database i`m getting an exception 'To many connection'.

I do not know the internal features of the database work, so i do not understand what is considered to be a connection, when a disconnection is happening etc.

For example: If I work with 3 TableAdapter. One for the periodic updating of data about users. The second constant (2-3 times per second) checks for new entries in the table "Chat", and the third as often checks a table online users.

So, sometimes a conditions occur, when there are not much copies of the program running, but the bug 'To many connection' is still there. I would like to understand - it is the result of my careless programming or is it all the same problem on the server side?

2 Answers2

0

The default value for 5.6 is 151 connections.

Do a:

mysqladmin -u root -p -i 5 extended-status | grep Max_used_connections

while your job is running.

If Max_used_connections is exceeded you can increase the max_connections global variable. Or otherwise investigate what your code is doing. But the error message is not a bug.

HTTP500
  • 4,833
  • 4
  • 23
  • 31
0

how many simultaneous connections are allowed to the server? Maybe you should increase this value?

Also verify that the problem is not related with a cyclic methods as TableAdapter.Fill for example. It can opens and closes a connection too fast for the server. Perhaps the server does not keep pace and keep the connection open a little longer.

And look at this discussion, it might help http://www.sqlservercentral.com/Forums/Topic1619584-2893-1.aspx

Instead TableAdapter you can load data into a DataSet using DataAdapters. Then you can specify open connection for the SelectCommand.Connection.