Chinaunix

标题: 问个弱智问题,怎么连接数据库执行命令 [打印本页]

作者: wgyzhechao    时间: 2010-01-21 13:14
标题: 问个弱智问题,怎么连接数据库执行命令
用db2实例用户登陆后

db2inst1@linux:~> db2 connect to sample

   Database Connection Information

Database server        = DB2/LINUXX8664 9.1.5
SQL authorization ID   = DB2INST1
Local database alias   = SAMPLE


db2inst1@linux:~> db2 select * from org
SQL0104N  An unexpected token "Documents" was found following "select bin
db2inst1".  Expected tokens may include:  ",".  SQLSTATE=42601


但是把语句放在文件里
db2inst1@linux:/hechao> cat sql.txt
connect to sample
select * from org
connect reset

db2 => db2inst1@linux:/hechao> db2 < sql.txt  确实成功的..
作者: wgyzhechao    时间: 2010-01-21 13:27
大家都不屑于回答啊?? 哎
作者: wgyzhechao    时间: 2010-01-21 13:44
已解决
作者: lypat2008    时间: 2010-01-25 10:04

作者: 智长老    时间: 2010-01-28 21:10
把sql语句放在" "之中,告诉系统是由CLP处理
作者: 魔~灵    时间: 2010-02-04 17:16
先进db2 中。

再执行就可以了。

要么就是 db2 'SQL语句!'




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2