金融其它数据库

perl 调用 db2cmd 执行sql语句时出现错

perl 调用 db2cmd 执行sql语句时出现错误: DB21061E  未初始化命令行环境。
跪求解决方案

代码:
   my $rc = open(DB2CMD, "|db2 -mtvsp-");

   # To see if bteq command invoke ok?
   unless ($rc) {
      print "Could not invoke BTEQ commandn";
      return -1;
   }
   ### Below are BTEQ scripts ###
   print DB2CMD <   db2 connect to rwa user administrator using lqfyyq@


ENDOFINPUT
   ##db2 connect TO rwa USER DB2ADMIN USING DB2;
   ### End of BTEQ scripts ###
   close(DB2CMD);

参与7

6同行回答

qingduo04qingduo04系统架构师华为
学习了!!!!显示全部
学习了!!!!收起
系统集成 · 2011-03-22
浏览867
这种方式也可以的。显示全部
这种方式也可以的。收起
2011-03-15
浏览889
mdkiimdkii软件开发工程师bocn
从TD转过来的吧,貌似DB2不如BTEQ,不能写控制语句。最好是改写成DBI+DBD的方式执行SQL。显示全部
从TD转过来的吧,貌似DB2不如BTEQ,不能写控制语句。
最好是改写成DBI+DBD的方式执行SQL。收起
银行 · 2011-03-15
浏览873
drdb2drdb2系统工程师se
你的code有语法错误,I modified it for you and tested run OK代码:   my $rc = open(DB2CMD, "|db2 -mtvsp-");   # To see if bteq command invoke ok?   unless ($rc) {      print "Could not invoke BTEQ command\...显示全部
你的code有语法错误,I modified it for you and tested run OK

代码:
   my $rc = open(DB2CMD, "|db2 -mtvsp-");

   # To see if bteq command invoke ok?
   unless ($rc) {
      print "Could not invoke BTEQ command\n";
      return -1;
   }
   ### Below are BTEQ scripts ###
   print DB2CMD <   connect to rwa user administrator using lqfyyq;
   ENDOFINPUT
   ##db2 connect TO rwa USER DB2ADMIN USING DB2;
   ### End of BTEQ scripts ###
   close(DB2CMD);收起
互联网服务 · 2011-03-15
浏览936
drdb2drdb2系统工程师se
The error massage itself says it clearlyDB21061E  Command line environment not initialized.Explanation:You have tried to invoke the command line processor from a commandwindow that was not started by db2cmd.exe.User response:Issue DB2CMD to...显示全部
The error massage itself says it clearly


DB21061E  Command line environment not initialized.

Explanation:

You have tried to invoke the command line processor from a command
window that was not started by db2cmd.exe.

User response:

Issue DB2CMD to start a command window that has the command line
processor environment initialized.收起
互联网服务 · 2011-03-15
浏览871
drdb2drdb2系统工程师se
回复 3# drdb2 Please see the tested:C:\ more test.plmy $rc = open(DB2CMD, "|db2 -mtvsp-");   # To see if bteq command invoke ok?   unless ($rc) {      print "Could not invoke BTEQ command\n";    ...显示全部
回复 3# drdb2

Please see the tested:

C:\ more test.pl

my $rc = open(DB2CMD, "|db2 -mtvsp-");
   # To see if bteq command invoke ok?
   unless ($rc) {
      print "Could not invoke BTEQ command\n";
      return -1;
   }
print DB2CMD <   connect to sample user db2admin using db2admin;
ENDOFINPUT
close(DB2CMD);

C:\ test.pl
connect to sample user db2admin using
   Database Connection Information
Database server        = DB2/NT 9.7.1
SQL authorization ID   = DB2ADMIN
Local database alias   = SAMPLE收起
互联网服务 · 2011-03-12
浏览909

提问者

dnnyyq
软件工程师宇信

相关问题

相关资料

相关文章

问题状态

  • 发布时间:2011-03-12
  • 关注会员:1 人
  • 问题浏览:5577
  • 最近回答:2011-03-22
  • X社区推广