Discussão do artigo "Como acessar o banco de dados MySQL a partir do MQL5 (MQL4)" - página 10

 
Meu e-mail: 178255721@qq.com
 
 
1982EAcsc :

Olá, parece que o MySQL nega a conexão para o usuário ODBC no localhost.

Você pode tentar verificar o StackOverflow: http://stackoverflow.com/questions/23950722/how-to-overcome-error-1045-28000-access-denied-for-user- odbclocalhost-u ;

how to overcome ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO) permanently
how to overcome ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO) permanently
  • stackoverflow.com
when am trying to open mysql in windows cmd by typing mysql. the following error is occuring. And then by looking similar queries i somehow got a temporary solution by using and then typing the password, is working...
 

Oi Eugeniy Lugovoy.

Usei o MQLMySQL para implementar as operações comuns de consulta, inserção, atualização e exclusão, mas há um problema: não é possível inserir chinês, a consulta fora do chinês também está distorcida. Gostaria de perguntar: o processo de empacotamento do middleware definiu o código? O fenômeno é o seguinte:

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;

Falha ao inserir chinês

Erro: A consulta estava vazia Consulta: 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,'Teste 12')

Inserção em inglês bem-sucedida

Sucesso: 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')


Para que serve isso?

 
Jiayou Hu:

Oi Eugeniy Lugovoy.

Usei o MQLMySQL para implementar as operações comuns de consulta, inserção, atualização e exclusão, mas há um problema: não é possível inserir chinês, a consulta fora do chinês também está distorcida. Gostaria de perguntar: o processo de empacotamento do middleware definiu o código? O fenômeno é o seguinte:

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;

Falha ao inserir chinês

Erro: A consulta estava vazia Consulta: 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,'Teste 12')

Inserção em inglês bem-sucedida

Sucesso: 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')


Para que serve isso?

Você pode tentar executar o próximo comando após a conexão do MySQL.

SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'

É possível que alguma dessas configurações não esteja definida como UTF.

 

Outra solução é executar os comandos seguintes um a um após a conexão.

SET NAMES 'utf8'

SET CHARACTER SET 'utf8'

SET SESSION collation_connection = 'utf8_general_ci'

 
Eugeniy Lugovoy:

Outra solução é executar os comandos seguintes um a um após a conexão.

SET NAMES 'utf8'

SET CHARACTER SET 'utf8'

SET SESSION collation_connection = 'utf8_general_ci'

Ainda não está funcionando, mas encontrei o problema

bool __stdcall MySqlExecute( int pConnection, wchar_t* pQuery)

{

...

char Query[16384];

sprintf_s(Query, wcslen(pQuery)+10, "%S", pQuery); // Ao executar essa linha, o idioma chinês é encontrado e Query se torna uma cadeia vazia, resultando em uma mensagem de erro: 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'

Você pode me ajudar a corrigir esse problema? Muito obrigado! Eu tenho 64 bits

 
Jiayou Hu:

Ainda não está funcionando, mas encontrei o problema

bool __stdcall MySqlExecute( int pConnection, wchar_t* pQuery)

{

...

char Query[16384];

sprintf_s(Query, wcslen(pQuery)+10, "%S", pQuery); // Ao executar essa linha, o idioma chinês foi encontrado e a Query se tornou uma string vazia, resultando em uma mensagem de erro: Error: Query was empty query: UPDATE tb_test_pat SET comments='Chinese'. test_pat SET comments='Chinese'

Você pode me ajudar a corrigir esse problema? Muito obrigado! Eu tenho 64 bits

Sim, "sprintf_s" e "sprintf's" não são compatíveis com o idioma chinês. Tentarei ajudá-lo a corrigir esse problema
 
Além disso, o UTF-8 não pode ser usado nesse caso, mas apenas o UTF-16
 
Eugeniy Lugovoy:
Além disso, o UTF-8 não pode ser usado nesse caso, mas somente o UTF-16!
O que isso significa? Isso significa definir a codificação do banco de dados com UTF-16? Ou significa converter a string chinesa para UTF-16?