Help using embedded connection and --local-infile=1!
Posted by: Carlos Quiros
Date: December 27, 2011 11:15AM


I am trying to connect using the embedded server and load a local file. I am using the following code:

static char *server_options[] = \
{ (char *)"mysql_test",
(char *)"--datadir=/home/cquiros/temp/mysql/db2",
(char *)"--default-storage-engine=MyISAM",
(char *)"--loose-innodb=0",
(char *)"--local-infile=1",
(char *)"--skip-grant-tables=1",
(char *)"--myisam-recover=FORCE",
(char *)"--key_buffer_size=16777216",
(char *)"--character-set-server=utf8",
(char *)"--collation-server=utf8_bin",

int num_elements = (sizeof(server_options) / sizeof(char *)) - 1;

mysql_library_init(num_elements, server_options, NULL);
m_mysql = mysql_init(NULL);

char enable_load_infile = 1;
if (mysql_options(m_mysql,MYSQL_OPT_LOCAL_INFILE, (const char *)&(enable_load_infile)))
qDebug() << "Error setting option";

mysql_real_connect(m_mysql, NULL,NULL,NULL, "database1", 0,NULL,0);

The connection works thus I can query and create tables, but when I use "load data local infile ..." I always get "The used command is not allowed with this MySQL version"

Any idea what I am doing wrong?

Many thanks,

Options: ReplyQuote

Written By
Help using embedded connection and --local-infile=1!
December 27, 2011 11:15AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.