[SOLVED] DATA TYPES

 

Hello everyone! 

I'm currently making an EA to feed a MySQL database with trading data.

My current issue is when pointing out to an external database.

//=====Connection To Database
string   host        = "";
int      port        = "";
string   socket      = "";
string   user        = "";
string   password    = "";
string   dbName      = "";

This is the portion of the code that connects to a database. 

The Host part is what is causing me trouble at the moment. It works great as "string" datatype when pointing to Localhost in local machine test.

But, I want to point to an external database. That means I'd need to point out to an IP address.

What would be the correct Data Type to store an IP address in MQL? 

Looking forward to your thoughts. 

Regards.

 

Please use the CODE button (Alt-S) when inserting code.

Code button in editor

 

Please note that MQL's file functions are sandboxed and cannot access any files out of it's sandbox folder.

Note

For security reasons, work with files is strictly controlled in the MQL4 language. Files with which file operations are conducted using MQL4 means, cannot be outside the file sandbox.

The file is opened in the folder of the client terminal in the subfolder MQL4\files (or Tester\Files in case of testing). If FILE_COMMON is specified among flags, the file is opened in a shared folder for all MetaTrader 4 client terminals.

FileOpen

Opens a file with a specified name and flag

 

Rookie mistake.


Turns out, an IP address can be stored as a string data type. 

My issue all this time was the password formatting of the Database.

MySQL server is configured to use the sha256_password authentication plugin, but the client which is MetaTrader 4 terminal does not support that plugin.

Solution was to simply change the Database password to a simpler one.