简体   繁体   中英

Execute Import / Load db2 command from PHP code

I am new to db2. I want to execute import command from my php code but I get following error. I have checked my db2 connection also it is working but command is not getting executed.

Command I used:

$output="IMPORT FROM receipt_master.del OF DEL INSERT INTO RECEIPT_MASTER (FIN_YEAR , TREA_CODE , MN_YY , MAJOR_HEAD , TRAN_ID , DATE , CHALLAN_NO)";

Error I am getting:

Warning: odbc_exec() [function.odbc-exec]:
SQL error: [IBM][CLI Driver][DB2/LINUXX8664] 
SQL0104N An unexpected token "receipt_master.del" was found following "IMPORT FROM ".
Expected tokens may include: "JOIN". SQLSTATE=42601 , SQL state 42601 in SQLExecDirect 

IMPORT is not a regular SQL statement and hence cannot be executed the way you are attempting it. You could look into calling the ADMIN_CMD procedure. Basically, you would call a procedure from your code. That procedure would then execute the IMPORT command on your behalf. There is an entire section on using IMPORT within the ADMIN_CMD .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM