简体   繁体   English

从PHP代码执行Import / Load db2命令

[英]Execute Import / Load db2 command from PHP code

I am new to db2. 我是db2的新手。 I want to execute import command from my php code but I get following error. 我想从我的PHP代码执行导入命令,但出现以下错误。 I have checked my db2 connection also it is working but command is not getting executed. 我检查了我的db2连接,它也正在工作,但命令未执行。

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. IMPORT不是常规的SQL语句,因此无法以您尝试的方式执行。 You could look into calling the ADMIN_CMD procedure. 您可以考虑调用ADMIN_CMD过程。 Basically, you would call a procedure from your code. 基本上,您将从代码中调用过程。 That procedure would then execute the IMPORT command on your behalf. 然后,该过程将代表您执行IMPORT命令。 There is an entire section on using IMPORT within the ADMIN_CMD . 在ADMIN_CMD中有一整节关于使用IMPORT的内容

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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