Import Informix data to Mysql

Asked

Viewed 47 times

0

I’m developing an application based on the data of an ERP. This ERP uses the INFORMIX database whose file export standard is BOUNDED BY PIPES AND WITHOUT TEXT RATING.

I want to create a query in INFORMIX and automatically import it into my application, which uses the Mysql database, periodically.

I created a php file to perform this task which I will activate it via crontab. However I am not able to import the file. I’m using the following code:

require_once("libraries/BD.class.php");
BD::conn();

LOAD DATA LOCAL INFILE 'ctplano.txt'
INTO TABLE ctplano
FIELDS TERMINATED BY '|'
LINES TERMINATED BY '\n'
(id_plano, nroplano, contared, contadep, contades, descrconta, natureza, resultado, pedecgccpf, pedeccusto, ctafluxo, diario, ativo); 

But you’re returning the message

Parse error: syntax error, Unexpected 'DATA' (T_STRING) in D: xampp htdocs Kurma Imports import.php on line 6

  • Is that all your code (php) is? There are no quotes missing there? send the Insert/load to the database?

  • 1

    You did not put a query in a string, and did not execute it, this code does nothing, put the query that loads the file in a variable, run it with the mysqli extension or PDO class, the syntax is correct, just need to execute in the right way.

  • Thank you for the reply. Could you give me a practical example please?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.