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

 

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

 
Khrisna Gunanasurya:

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 Khrisna, Did you solve the mistake?
 

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.

 
cikahun:

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

SQL
  • 2012.12.13
  • Joel Lipman
  • www.joellipman.com
Posted on Dec 13, 12 at 01:12 PM What? In view of the fact that this error pops up in so many systems I take over, I have often gone down the wrong path following the red herring as it were when in fact the answer to this is very common. Why? Bespoke systems are the usual suspects. Developers will have told the system what to do when...
 

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; &nbsp ; |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{

&nbsp ; MySqlDisconnect(DB);


}
//+--------------------------------------------------------------- ---+
//| Expert tick function & nbsp; &nbsp ; ||
//+------------------------------------------------------------------+
void OnTick()
{
//---
& nbsp;
}
//+------------------------------------------------------------------+

the X64 version dll file can not be loaded.

 
I'm using multi-insert query but it doesnt works, but when I use single-insert, it works, this is the query 

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

 
Eugeniy Lugovoy:

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. )

 
can you help me to change charset to UTF-8,thank you very much