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

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
MT4 build 890 x32 just checked. Everything works.
Log of running test scripts:
Guys, please clarify:
1. On what operation it gives"Access violation read" ?
2. When running the MySQL-001 script, what version of MQLMySQL is shown on the Experts tab? should be: MQLMySQL v2.2 x32 Copyright © 2014, FxCodex Laboratory
3. What version of MySQL database?
4. Is MySQL used locally or on a remote host?
5. Under which operating system do you run the terminal?
Please check and report back, as I can't reproduce the error.
I will create a similar environment and test.
I am using MT4 (950). I took the files from the archive attached to the article. Did I understand correctly that it is not the latest version?: MySQL-001 EURUSD,M1: MQLMySQL v2.0 Demo Copyright © 2014, FxCodex Laboratory.
It does not read data from the configuration file.
I use MT4 (950). I took the files from the archive attached to the article. Did I understand correctly that it is not the latest version?: MySQL-001 EURUSD,M1: MQLMySQL v2.0 Demo Copyright © 2014, FxCodex Laboratory
It does not read data from the config. file.
Yes, v2.0 is old. I have already posted newer versions in the discussion of the article.
I will attach it now.
MQLMySQL v2.2 - DLL project sources for x64 and x86
Try something from this. It seems to be the latest version.
Based on error I see from your log: 0 11:09:37.742 MySQL-002 EURUSD,H1: Table `table` cannot be created.
you are uses name "table" which is keyword of mysql database and cannot be used as table name, try to change to for example to "table1" just to check is it works.
or possible the database was not selected or was not set. you can execute command "USE database_name" right after connection, where the database_name is the name of your database.
for example if my database is "mysql":
DB = MySqlConnect(Host, User, Password, Database, Port, Socket, ClientFlag);
if (DB == -1) { Print ("Connection failed! Error: "+MySqlErrorDescription); } else { Print ("Connected! DBID#",DB);}
MySqlExecute(DB, "USE mysql");
Well, I followed your suggestions for the tables's name and the MySqlExecute(DB, "USE mt4") command but I still get the error message:
0 12:51:40.534 Script MySQL-002new EURUSD,M1: loaded successfully
0 12:51:40.549 MySQL-002new EURUSD,M1: initialized
0 12:51:40.549 MySQL-002new EURUSD,M1: MQLMySQL v2.0 Demo Copyright © 2014, FxCodex Laboratory
0 12:51:40.549 MySQL-002new EURUSD,M1: Host: , User: , Database:
0 12:51:40.549 MySQL-002new EURUSD,M1: Connecting...
0 12:51:40.565 MySQL-002new EURUSD,M1: Connected! DBID#0
0 12:51:40.565 MySQL-002new EURUSD,M1: Table `test_table` cannot be created. Error: Aucune base n'a ?t? s?lectionn?e
0 12:51:40.565 MySQL-002new EURUSD,M1: Disconnected. Script done!
0 12:51:40.565 MySQL-002new EURUSD,M1: uninit reason 0
0 12:51:40.565 Script MySQL-002new EURUSD,M1: removed
Hello Eugeniy Lugovoy,
Big Thanks for your useful project.
I'm trying to read a string field from a table that it is about 3,000 characters, I used "MySqlGetFieldAsString" like this:
if (Cursor >= 0)
{
Rows = MySqlCursorRows(Cursor);
for (int i=0; i<Rows; i++)
if (MySqlCursorFetchRow(Cursor))
{
Get_Setting = MySqlGetFieldAsString(Cursor, 4);
}
.....
But the problem is Get_String returns me only 1025 characters,
I need to read that field completely.
Can you help me to solve this?
Regards
Hello Eugeniy Lugovoy,
Big Thanks for your useful project.
I'm trying to read a string field from a table that it is about 3,000 characters, I used "MySqlGetFieldAsString" like this:
if (Cursor >= 0)
{
Rows = MySqlCursorRows(Cursor);
for (int i=0; i<Rows; i++)
if (MySqlCursorFetchRow(Cursor))
{
Get_Setting = MySqlGetFieldAsString(Cursor, 4);
}
.....
But the problem is Get_String returns me only 1025 characters,
I need to read that field completely.
Can you help me to solve this?
Regards
Well, I followed your suggestions for the tables's name and the MySqlExecute(DB, "USE mt4") command but I still get the error message:
0 12:51:40.534 Script MySQL-002new EURUSD,M1: loaded successfully
0 12:51:40.549 MySQL-002new EURUSD,M1: initialized
0 12:51:40.549 MySQL-002new EURUSD,M1: MQLMySQL v2.0 Demo Copyright © 2014, FxCodex Laboratory
0 12:51:40.549 MySQL-002new EURUSD,M1: Host: , User: , Database:
0 12:51:40.549 MySQL-002new EURUSD,M1: Connecting...
0 12:51:40.565 MySQL-002new EURUSD,M1: Connected! DBID#0
0 12:51:40.565 MySQL-002new EURUSD,M1: Table `test_table` cannot be created. Error: Aucune base n'a ?t? s?lectionn?e
0 12:51:40.565 MySQL-002new EURUSD,M1: Disconnected. Script done!
0 12:51:40.565 MySQL-002new EURUSD,M1: uninit reason 0
0 12:51:40.565 Script MySQL-002new EURUSD,M1: removed
Excellent!
Using MQL5 to generate data for MQL4.
Everything worked beautifully except that I had to remove the single quotes around tablename on the query command
Query = "SELECT Symbol,Composite,Pattern FROM summarytable";
works ok
Excellent!
Using MQL5 to generate data for MQL4.
Everything worked beautifully except that I had to remove the single quotes around tablename on the query command
Query = "SELECT Symbol,Composite,Pattern FROM summarytable";
works ok
Yes, it's possible to use without quotation if you do not plan to name tables with upper/lower case (mysql is case sensitive) and special symbols. BTW, it's not single quote symbol "'", but it's "`"
So you query also could be: Query = "SELECT `Symbol`,`Composite`,`Pattern` FROM `summarytable`";
if you want to name columns Symbol, but not symbol or SYMBOL
Hi Eugeniy,
Thank for your module, very helpful. Could you help to add function to get Field Name? or how I could add it in VC++?
how are you !
system win10 64x, Unable to connect to the database ,can you help me ?