Libraries: MySQL for new MQL4 (tested in build 600) - page 5

 

I had an error with your libraray using build 765:

 Can't connect to MySQL server on 'localhost' (10055)

this is a windows error and the fix is:

Type the following
netsh int ipv4 set dynamicport tcp start=10000 num=50000
Press Enter

Type the following
netsh int ipv4 set dynamicport udp start=10000 num=50000
Press Enter

Type the following
netsh int ipv6 set dynamicport tcp start=10000 num=50000
Press Enter

Type the following
netsh int ipv6 set dynamicport udp start=10000 num=50000

Press Enter 

 
This dll version is more / less stable ....with  mt4, build 765
Files:
libmysql.zip  545 kb
 
winterss:
This dll version is more / less stable ....with  mt4, build 765
It looks like mt4 does not work well with memory, it growed from 400mb to 1200mb during the 1 year backtest
 

For people who have problems with using this library  or have just started using it -> READ THIS 

  • MT4 doesn't  manage memory properly or there's a problem within library -> I haven't found the location of this problem yet, but the thing is, the longer you use the library without closing MT4, the more RAM  will be allocated (check your system resources -> Memory -> MT4). This isn't  a mayor problem, since memory usage increase is very slow. For example: I am using several EA, who write data into DB every hour and RAM increase in a week is around 3 GB (estimate). It depends on usage(quantity) so it will be different for different systems/programs. Monitor MT4 memory usage!
  • If you try to use code from example in this article, you will get error after a few minutes. The problem is again with memory, if you declare int dbConnectId = 0; as a global variable, with every call of library you connection will be allocated to the same memory adress. This is not a problem if used with script, but in EAs and indicators it will cause you MT4 to crush after a few minutes. Solution is simple, just use local declaration of dbConnectId = 0 (inside a function), so whenever function is called, new connection will be automaticly allocated to new memory slot. 
  • This is also a more of a proper way, since connection is only opened for the time it needs to complete it's job and then it's terminated (use a proper function to terminate connection, don't just force it). This will also alove you to open several conection without interfering with each other. 
  • Warning: Don't forget for possible transaction interference, code proper protection, because if you get a Read or Write violation, it will stop your EA.
  • If you wan't simple DB, server and DB management tool (it's free and frendly for users) -> https://www.apachefriends.org/index.html 
  • Read this for how to set protection for DB -> http://robsnotebook.com/xampp-builtin-security

 

If i wrote something wrong, send me a message

 

InfiniteLoop 

 

I'm on MT4 build 840 & My SQL 5.6.26 both on Win 10 64 bit

I'm getting  this error in console: 2015.09.20 11:58:40.899 Access violation read to 0x00000358

Is this because of the environment I'm using? Appreciate its unsupported, and will run up a 32 bit machine if so.

Just don't want to get a sledgehammer if someone has found the nutcracker.

Grateful for any help.

 

 

Hello. Thank you for such a convenient tool.

Noticed two problems, any help is appreciated:

2017.01.30 20:26:21.183 mysql_sender1 EURUSD,M5: MySQL_NoError: mysql_errno: 2006; mysql_error: MySQL server has gone away
2017.01.30 20:26:21.208 Access violation read to 0x00000000 in 'C:\Users\Daniel\AppData\Roaming\MetaQuotes\Terminal\9B4D987C584A44E8CF24C3DBAFEE98C5\MQL4\Libraries\libmysql.dll'


it happens sometimes, no idea why, after restart of terminal it works. server is at vps, far from ea. cannot predict when it fails again. Tried to reconnect after such error but that doesnt help

 

another problem - i tried tables with 1- 7 columns and also 8. all works. if table has 9 columns or more - it catches critical error. maybe only at win7

 
How can we avoid  MySQL_NoError: mysql_errno: 2006; mysql_error: MySQL server has gone away?
Reason: