mysql connections

 

My EA connects to a mysql database.   But when I run strategy tester, I see a huge number of error messages stating "errorn 1040 too many connections"

Since I control the db I took a look at it to see if I could detect the prob.  There were 65 connections which is way too high.   I rebooted the db, and got same number.

I believe that my EA is trying to open a new connection for each trade, but isn't closing the connection.

Is there some code I could use to tell the EA to open a connection and leave it open as long as the ea is running?

 
RTaylor:

My EA connects to a mysql database.   But when I run strategy tester, I see a huge number of error messages stating "errorn 1040 too many connections"

Since I control the db I took a look at it to see if I could detect the prob.  There were 65 connections which is way too high.   I rebooted the db, and got same number.

I believe that my EA is trying to open a new connection for each trade, but isn't closing the connection.

Is there some code I could use to tell the EA to open a connection and leave it open as long as the ea is running?

If it is your EA and/or DLL, then fix your code so as to either reuses the connection or closes it.
 
RTaylor:

My EA connects to a mysql database.   But when I run strategy tester, I see a huge number of error messages stating "errorn 1040 too many connections"

Since I control the db I took a look at it to see if I could detect the prob.  There were 65 connections which is way too high.   I rebooted the db, and got same number.

I believe that my EA is trying to open a new connection for each trade, but isn't closing the connection.

Is there some code I could use to tell the EA to open a connection and leave it open as long as the ea is running?

Open the connection if/when you need it, store the handle in a global or static function variable, reuse the variable. Close the connection in OnDeinit().
Reason: