从python脚本将文件导入DB2时出错 [英] Error while importing file into DB2 from python script
本文介绍了从python脚本将文件导入DB2时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在尝试使用python 2.4.3将 ^
分隔文件导入DB2数据库时,出现以下错误。
Getting the below error while trying to import a ^
delimited file into a DB2 database using python 2.4.3.
错误:
Traceback (most recent call last):
File "C:\Python25\Usefulscripts\order.py", line 89, in <module>
load_order_stack()
File "C:\Python25\Usefulscripts\order.py", line 75, in load_order_stack
conn2.execute(importTmp)
ProgrammingError: ('42601', '[42601] [IBM][CLI Driver][DB2/LINUXX8664] SQL0104N An unexpected token "orders_extract"
$在从...导入之后找到b $ b
。
was found following "import from ".
代码:
import pyodbc
def load_order_stack():
try:
conn2 = pyodbc.connect('DSN=db2Database;UID=ueserid;PWD=password')
importTmp = ("import from orders_extract of del modified by coldel0x5E"
"insert_update into test.ORDERS_Table (ORDER_ID,item,price);")
conn2.execute(importTmp)
conn2.commit()
推荐答案
IMPORT不是SQL语句,它是一个DB2命令行处理器(CLP)命令,因此只能由该CLP运行。
IMPORT is not an SQL statement. It is a DB2 Command Line Processor (CLP) command and as such can only be run by the said CLP.
T这是通过调用ADMIN_CMD()存储过程来访问某些CLP命令的SQL接口,请查看手册: IMPORT使用ADMIN_CMD
There is an SQL interface to some CLP commands via calls to the ADMIN_CMD() stored procedure, please check the manual: IMPORT using ADMIN_CMD
这篇关于从python脚本将文件导入DB2时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文