Perl DB2数据库连接问题

时间:2014-06-18 06:49:23

标签: html perl tomcat db2 cgi

我是Perl的新手。

我的要求是通过HTML页面从用户那里获取输入,并使用Perl脚本将相同的数据插入或更新到DB2数据库中。

但是在这里我无法连接到DB2数据库。我在apache tomcat日志中遇到以下错误:

Jun 18, 2014 11:59:14 AM org.apache.catalina.core.ApplicationContext log
INFO: cgi: runCGI (stderr):install_driver(DB2) failed: Can't load 'C:/strawberry/perl/site/lib/auto/DBD/DB2/DB2.dll' for module DBD::DB2: load_file:The specified module could not be found at C:/strawberry/perl/lib/DynaLoader.pm line 190.

Jun 18, 2014 11:59:14 AM org.apache.catalina.core.ApplicationContext log
INFO: cgi: runCGI (stderr): at (eval 7) line 3.

Jun 18, 2014 11:59:14 AM org.apache.catalina.core.ApplicationContext log
INFO: cgi: runCGI (stderr):Compilation failed in require at (eval 7) line 3.

Jun 18, 2014 11:59:14 AM org.apache.catalina.core.ApplicationContext log
INFO: cgi: runCGI (stderr):Perhaps a required shared library or dll isn't installed where expected

Jun 18, 2014 11:59:14 AM org.apache.catalina.core.ApplicationContext log
INFO: cgi: runCGI (stderr): at D:\apache-tomcat-7.0.54-windows-x64\apache-tomcat-7.0.54\webapps\ROOT\WEB-INF\cgi\SamplePerl.cgi line 10.

这是使用的Perl脚本:SamplePerl.pl

#!C:\strawberry\perl\bin\perl.exe

use CGI;
use DBI;
use DBI;
use DBD::DB2::Constants;
use DBD::DB2;

$dbh = DBI->connect("dbi:DB2:reporter", "db2inst1", "Zaq12wsx");

print "Content-type: text/html\n\n";
print "Hello, world!\n";

请通过Perl Script配置与DB2的连接设置,并执行更新,插入,获取操作。

0 个答案:

没有答案