Discussion of article "How to Access the MySQL Database from MQL5 (MQL4)" - page 5

 

Hello sir ,my MT4 show :Connection failed! Error: Maximum connections exceeded.——how can I deal with this problem? I guess the Maximum connections are 32,how can I raise the connections to such as 64 ?

thanks for helping,sir.

 
illman:

Hello sir ,my MT4 show :Connection failed! Error: Maximum connections exceeded.——how can I deal with this problem? I guess the Maximum connections are 32,how can I raise the connections to such as 64 ?

thanks for helping,sir.

Hello,

Yes the max number of connections is 32 

Are you trying to use your MQL program based on MQLMySQL.dll on more than 32 charts concurrently?

Or you just forgot to close the connection in your program? 

To change max connection from 32 to another you have to rebuild MQLMySQL.DLL. The sources are attached to the article, you have to:

1. Unpack sources from "MQLMySQL DLL Project MSVS-2010.zip"

2. Load the project into MS Visual Studio 2010 or higher

3. Open file "MQLMySQL.h"

4. Find string:

// database definition
#define MAX_CONNECTIONS 32

and replace value 32 with 64 or whatever you want

// database definition
#define MAX_CONNECTIONS 64

5. Rebuild the project

6. Replace an old DLL in your Metatrader data folder with new compiled.

Regards,

Eugene 

 

elugovoy:

      You explained very  clearly.Because,I use a lot of extraneous data for my index ,so the connections become very large ,once more than 32 ,MT4 will point out “error” and show nothing in the index windows.

thank you for your kind help and your effort of developing these all!


Hello,

Yes the max number of connections is 32 

Are you trying to use your MQL program based on MQLMySQL.dll on more than 32 charts concurrently?

Or you just forgot to close the connection in your program? 

To change max connection from 32 to another you have to rebuild MQLMySQL.DLL. The sources are attached to the article, you have to:

1. Unpack sources from "MQLMySQL DLL Project MSVS-2010.zip"

2. Load the project into MS Visual Studio 2010 or higher

3. Open file "MQLMySQL.h"

4. Find string:

and replace value 32 with 64 or whatever you want

5. Rebuild the project

6. Replace an old DLL in your Metatrader data folder with new compiled.

Regards,

Eugene 

 

First all, thanks for the lib, is by far the better solution out there and the most documented.

I was wondering if there is any way to get the affected rows after an update statement, in order to execute an insert if updated records is 0 (the update succeed, just doesn't update any records because the  "where" filter conditions).

I don't want to use a "insert on duplicate key update" because 99.9% of the time the update statement will effectively update 1 record (already exists), and therefore there's no need to execute the insert. I guess there's a performance impact trying to insert always with no need. 

Thanks in advance! 

 
jmhoms:

First all, thanks for the lib, is by far the better solution out there and the most documented.

I was wondering if there is any way to get the affected rows after an update statement, in order to execute an insert if updated records is 0 (the update succeed, just doesn't update any records because the  "where" filter conditions).

I don't want to use a "insert on duplicate key update" because 99.9% of the time the update statement will effectively update 1 record (already exists), and therefore there's no need to execute the insert. I guess there's a performance impact trying to insert always with no need. 

Thanks in advance! 

Hello dear friend, 

If you have MSVC 2010 you can download the sources of MQLMySQL.DLL and add the function you need; the MySQL C++ API has such function (http://dev.mysql.com/doc/refman/5.0/en/mysql-affected-rows.html)

Or I can do it for you, but right now I have no time for this, can do on weekend (7-8 March, 2015), is it allright with you?

Regards,

Eugene 

 
elugovoy:

Hello dear friend, 

If you have MSVC 2010 you can download the sources of MQLMySQL.DLL and add the function you need; the MySQL C++ API has such function (http://dev.mysql.com/doc/refman/5.0/en/mysql-affected-rows.html)

Or I can do it for you, but right now I have no time for this, can do on weekend (7-8 March, 2015), is it allright with you?

Regards,

Eugene 

Of course it works for me !!! 

 Thank you very much.

Josep M. 

 

Hi Eugeniy, 

did you have the chance to have a look at the "affected rows" feature ?

Greetings,

Josep M. 

 
jmhoms:

Hi Eugeniy, 

did you have the chance to have a look at the "affected rows" feature ?

Greetings,

Josep M. 

 Hello Josep,

I've replied in private message.

Anyway I'm posting here the v2.2. Tested on MT4. If you have troubles with MT5 (x32/x64) just let me know.

Happy working! 

Files:
MQL4_x32.zip  1073 kb
MQL5_x32.zip  1073 kb
MQL5_x64.zip  1076 kb
MQLMySQL_v2_2.zip  5072 kb
 
elugovoy:
For x64 platforms, use the following library (with discussion)
Access violation read to 0x72656472
 

Hello, which version of MT5 terminal you are using?

Which version of MT5 terminal you are uses?

please try latest update of MQLMySQL libraries, attached here.

Files:
MQL4_x32.zip  1073 kb
MQL5_x32.zip  1073 kb
MQL5_x64.zip  1076 kb
MQLMySQL_v2_2.zip  5072 kb