Discussion of article "How to Access the MySQL Database from MQL5 (MQL4)" - page 10
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
Hello, it looks like MySQL deny connection for user ODBC on localhost.
You can try to check StackOverflow: http://stackoverflow.com/questions/23950722/how-to-overcome-error-1045-28000-access-denied-for-user- odbclocalhost-u ;
Hi Eugeniy Lugovoy.
I used MQLMySQL to implement the common query, insert, update, delete operations, but there is a problem, can not insert Chinese, query out of the Chinese is also garbled, I would like to ask, you middleware packaging process have set the encoding? I want to ask, you middleware packaging process has set the code? The phenomenon is as follows:
DROP TABLE IF EXISTS `tb_test_pat`;
CREATE TABLE `tb_test_pat` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `symbol` varchitecture
`symbol` varchar(255) NOT NULL, `start_time` datetime, `tb_test_pat`; CREATE TABLE
`start_time` datetime NOT NULL,
`end_time` datetime NOT NULL, `trend` int(255)
`trend` int(10) NOT NULL, `points` int(10)
`points` int(10) unsigned zerofill NOT NULL, `comments` text CHARacteristic
`comments` text CHARACTER SET utf8,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Failed to insert Chinese
Error: Query was empty query: INSERT INTO tb_test_pat (trend, symbol, start_time, end_time, points, comments) VALUES (1, 'EURUSD ','2014.12.16 13:00 ','2014.12.17 20:00',8,'Test 12')
English Insertion Succeeded
Succeeded: INSERT INTO tb_test_pat (trend, symbol, start_time, end_time, points, comments) VALUES (1,'EURUSD','2014.12.16 13:00','2014.12.17 20 :00',8,'abc')
What's this for?
Hi Eugeniy Lugovoy.
I used MQLMySQL to implement the common query, insert, update, delete operations, but there is a problem, can not insert Chinese, query out of the Chinese is also garbled, I would like to ask, you middleware packaging process have set the encoding? I want to ask, you middleware packaging process has set the code? The phenomenon is as follows:
DROP TABLE IF EXISTS `tb_test_pat`;
CREATE TABLE `tb_test_pat` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `symbol` varchitecture
`symbol` varchar(255) NOT NULL, `start_time` datetime, `tb_test_pat`; CREATE TABLE
`start_time` datetime NOT NULL,
`end_time` datetime NOT NULL, `trend` int(255)
`trend` int(10) NOT NULL, `points` int(10)
`points` int(10) unsigned zerofill NOT NULL, `comments` text CHARacteristic
`comments` text CHARACTER SET utf8,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Failed to insert Chinese
Error: Query was empty query: INSERT INTO tb_test_pat (trend, symbol, start_time, end_time, points, comments) VALUES (1,'EURUSD','2014.12.16 13:00 ','2014.12.17 20:00',8,'Test 12')
English Insertion Succeeded
Succeeded: INSERT INTO tb_test_pat (trend, symbol, start_time, end_time, points, comments) VALUES (1,'EURUSD','2014.12.16 13:00','2014.12.17 20 :00',8,'abc')
What's this for?
You can try to execute next command after MySQL connect.
SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'
Possible some of such settings is not set to UTF.
Another one solution to executenext commands one-by-one after connection.
SET NAMES 'utf8'
SET CHARACTER SET 'utf8'
SET SESSION collation_connection = 'utf8_general_ci'
Another one solution to executenext commands one-by-one after connection.
SET NAMES 'utf8'
SET CHARACTER SET 'utf8'
SET SESSION collation_connection = 'utf8_general_ci'
It still doesn't work, but I found the problem
bool __stdcall MySqlExecute( int pConnection, wchar_t* pQuery)
{
...
char Query[16384];
sprintf_s(Query, wcslen(pQuery)+10, "%S", pQuery); // When executing to this line, Chinese is encountered, and Query becomes an empty string resulting in an error message: Error: Query was empty query: UPDATE tb_test_pat SET comments_test_pat SET comments_test_pat SET comments_test_pat SET comments_test_pat SET comments_test_pat SET comments_test_pat test_pat SET comments='Chinese'
Can you help to fix this problem? Thank you very much! I'm 64 bit
It still doesn't work, but I found the problem
bool __stdcall MySqlExecute( int pConnection, wchar_t* pQuery)
{
...
char Query[16384];
sprintf_s(Query, wcslen(pQuery)+10, "%S", pQuery); // When executing to this line, Chinese was encountered, and Query became an empty string resulting in an error message: Error: Query was empty query: UPDATE tb_test_pat SET comments='Chinese'. test_pat SET comments='Chinese'
Can you help to fix this problem? Thank you very much! I'm 64 bit
Also UTF-8 cannot be used in this case, but only UTF-16!