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

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
It's very useful.
But there is a problem when i insert chinese word into mysql use cmd like this "INSERT INTO table (name,value) VALUES ('Buy Order','Sell Order');", it return &# nbsp;an error description "Query is empty. nbsp;an error description "Query is empty."
How to solve this problem.
How to solve this problem.
Colleagues, please duplicate the actual release(s),
I personally need a build for MQL5 x64, I can't download it using the links from the thread - 404
Hi, why I got this message? how to fix it?
Connection failed! Error: Can't connect to MySQL server on 'mysql.hostinger.co.id' (10061) <~~~ before it was 10060, i don't know why it's changing to that one
Can someone help me to solve it? I already tried googled it but I hit a wall.
Thank you
Hi,
I have a question. I'd like to record the trade in MySQL table but always get an error message that the query is empty.
When I print the error and the query, it is there:
Error #1065: Query was empty; 3
Query: INSERT INTO algo_trades (date, time, curr, ticket, error, trade, lot, entry, sl, tp, spread) VALUES ('2017-9-1','14:3:58','GBPUSD',8705334,0,'Sell',2,1.29892,1.29961,1.29812,0.9)
What cloud be wrong? I'm using this library in another code in the same way, and works absolutely fine.
Thanks a lot Eugeniy for sharing it.
Hi,
I have a question. I'd like to record the trade in MySQL table but always get an error message that the query is empty.
When I print the error and the query, it is there:
Error #1065: Query was empty; 3
Query: INSERT INTO algo_trades (date, time, curr, ticket, error, trade, lot, entry, sl, tp, spread) VALUES ('2017-9-1','14:3:58','GBPUSD',8705334,0,'Sell',2,1.29892,1.29961,1.29812,0.9)
What cloud be wrong? I'm using this library in another code in the same way, and works absolutely fine.
Thanks a lot Eugeniy for sharing it.
Probably faster to use Google.
http://www.joellipman.com/articles/sql/error-1065-query-was-empty.html
Probably faster to use Google.
http://www.joellipman.com/articles/sql/error-1065-query-was-empty.html
Hi Alain,
Thanks a lot! I could figure it out what was wrong.
In my case the broker gives me the currency symbol with a £ sign. I've deleted it and it works.
Thanks again.
I used the attechtment dll to run EA, but it did not work and the log showed
"Cannot load 'C:\Users\ccb\AppData\Roaming\MetaQuotes\Tester\67381DD86A2959850232C0BA725E5966\Agent-127.0.0.1-3000\MQL5\libraries\' [193] Cannot call 'cMySqlVersion' [193] I used the attechtment dll to run EA but it did not work and the log showed MQLMySQL.dll' [193]
Cannot call 'cMySqlVersion', '... \libraries\MQLMySQL.dll' is not loaded
unresolved import function call"
Im using the mt5 x64
and here is my code.
#include <MQLMySQL.mqh>
//--- input parameters
string INI;
string Host, User, Password, Database, Socket; // database credentials
int Port, ClientFlag; int ClientFlag;
int DB; // database identifier
//+------------------------------------------------------------------+
//| Expert initialisation function & nbsp; |
//+------------------------------------------- -----------------------+
int OnInit()
{
Print (MySqlVersion());
INI = TerminalInfoString(TERMINAL_PATH) + "\\\ MQL5\\Scripts\\\ MyConnection.ini";
// reading database credentials from INI file
Host = ReadIni(INI, "MYSQL", "Host");
User = ReadIni(INI, "MYSQL", "User");
Password = ReadIni(INI, "MYSQL", "Password");
Database = ReadIni(INI, "MYSQL", "Database");
Port = (int)StringToInteger(ReadIni(INI, "MYSQL", "Port"));
Socket = ReadIni(INI, "MYSQL", " Socket");
ClientFlag = CLIENT_MULTI_STATEMENTS; //(int)StringToInteger(ReadIni(INI, "MYSQL", "ClientFlag"));
Print (" Host: ",Host, ", User: ", User, ", Database: ",Database);
// open database connection
Print ("Connecting...") ;
DB = MySqlConnect(Host, User, Password, Database, Port, Socket, ClientFlag);
if (DB == -1)
Print (" Connection failed!Error: "+MySqlErrorDescription);
else Print ("Connected!DBID#",DB);
return 1;
}
//+-------------------- ----------------------------------------------+
//| Expert deinitialisation function & nbsp;   ; |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
  ; MySqlDisconnect(DB);
}
//+--------------------------------------------------------------- ---+
//| Expert tick function & nbsp;   ; ||
//+------------------------------------------------------------------+
void OnTick()
{
//---
& nbsp;
}
//+------------------------------------------------------------------+
the X64 version dll file can not be loaded.
Query = Query + "INSERT INTO `history` (an, oi, oc) VALUES (" + (string) AccountNumber() + ", " + (string) OrderTicket() + ", '" + (string) OrderComment() + "');";
what do i do wrong? it works with single-insert only
Hmmm... it's somewhere in the old library, in the latest versions (posted in the discussion) I have the rules if my memory serves me correctly :)
Ok. then the UTF problem remains. i will try to solve it this week till the weekend, if i am not overworked.
Good afternoon Eugene.
Thank you very much for this library, I actively use it in my project.
Could you please tell me if you managed to solve the problem with UTF? And how can I download the current release?
I need MQL4 x32-x64 build. Thanks again. )