来自 CPAN 的 Perl JDBC 模块使用问题

问题描述

我正在尝试从 CPAN 安装和使用 DBD::JDBC 模块并遇到问题。论坛中的任何 PERL 专家都可以帮助我指出问题所在吗?

我使用 root 使用以下所有操作。

这是我的 PERL 和 CPAN 版本,并在安装的 DBD::JDBC 模块上证明:

$perl -v

This is perl 5,version 28,subversion 1 (v5.28.1) built for x86_64-linux-thread-multi
(with 1 registered patch,see perl -V for more detail)

Copyright 1987-2018,Larry Wall

Binary build 0000 [cda01a35] provided by ActiveState http://www.ActiveState.com
Built Oct 28 2020 16:15:32

$cpan -v
Loading internal logger. Log::Log4perl recommended for better logging
>(info): /root/.cache/activestate/20d7a5e1/bin/cpan script version 1.67,CPAN.pm version 2.20


$cpanm -v
cpanm (App::cpanminus) 1.7044 on perl 5.016003 built for x86_64-linux-thread-multi
Work directory is /root/.cpanm/work/1618506734.31834
You have make /bin/make
You have /bin/wget
You have /bin/tar: tar (GNU tar) 1.26
Copyright (C) 2011 Free Software Foundation,Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY,to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.

这是 JDBC 失败的地方:

$cpanm install DBD::JDBC
install is up to date. (0.01)
--> Working on DBD::JDBC
Fetching http://www.cpan.org/authors/id/V/VI/VIZDOM/DBD-JDBC-0.71.tar.gz ... OK
Configuring DBD-JDBC-0.71 ... OK
Building and testing DBD-JDBC-0.71 ... FAIL
! Installing DBD::JDBC failed. See /root/.cpanm/work/1618506799.31847/build.log for details. Retry with --force to force install it.

看下面我看不到太多信息:/root/.cpanm/work/1618506799.31847/build.log

$cat /root/.cpanm/work/1618506799.31847/build.log
cpanm (App::cpanminus) 1.7044 on perl 5.016003 built for x86_64-linux-thread-multi
Work directory is /root/.cpanm/work/1618506799.31847
You have make /bin/make
You have /bin/wget
You have /bin/tar: tar (GNU tar) 1.26
Copyright (C) 2011 Free Software Foundation,to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.
You have /bin/unzip
Searching install () on cpanmetadb ...
install is up to date. (0.01)
Searching DBD::JDBC () on cpanmetadb ...
--> Working on DBD::JDBC
Fetching http://www.cpan.org/authors/id/V/VI/VIZDOM/DBD-JDBC-0.71.tar.gz
-> OK
Unpacking DBD-JDBC-0.71.tar.gz
Entering DBD-JDBC-0.71
META.yml/json not found. Creating skeleton for it.
Configuring DBD-JDBC-0.71
Running Makefile.PL
Checking if your kit is complete...
Looks good
Using DBI 1.627 (for perl 5.016003 on x86_64-linux-thread-multi) installed in /usr/lib64/perl5/vendor_perl/auto/DBI/
Writing Makefile for DBD::JDBC
-> OK
Finding PREREQ from Makefile ...
Checking if you have Convert::BER 1.31 ... Yes (1.32)
Checking if you have DBI 1.48 ... Yes (1.627)
Building and testing DBD-JDBC-0.71
cp JDBC.pod blib/lib/DBD/JDBC.pod
cp JDBC.pm blib/lib/DBD/JDBC.pm
cp lib/Bundle/DBD/JDBC.pm blib/lib/Bundle/DBD/JDBC.pm
Manifying blib/man3/DBD::JDBC.3pm
Manifying blib/man3/Bundle::DBD::JDBC.3pm
PERL_DL_NONLAZY=1 CLASSPATH=dbd_jdbc.jar:t/hsqldb/hsqldb-1.8.0.2.jar:t/hsqldb/log4j-1.2.13.jar: /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0,'blib/lib','blib/arch')" t/*.t
t/01_env.t ...... ok
t/02_connect.t .. ok
# Looks like your test exited with 1 just after 22.
t/03_hsqldb.t ...
Dubious,test returned 1 (wstat 256,0x100)
All 22 subtests passed
t/basis.t ....... skipped: BASIS URL not defined
t/oracle.t ...... skipped: Oracle URL not defined

Test Summary Report
-------------------
t/03_hsqldb.t (Wstat: 256 Tests: 22 Failed: 0)
  Non-zero exit status: 1
Files=5,Tests=32,7 wallclock secs ( 0.02 usr  0.01 sys +  0.23 cusr  0.05 csys =  0.31 CPU)
Result: FAIL
Failed 1/5 test programs. 0/32 subtests failed.
make: *** [test_dynamic] Error 255
-> FAIL Installing DBD::JDBC failed. See /root/.cpanm/work/1618506799.31847/build.log for details. Retry with --force to force install it.

所以似乎在 make test 步骤失败了。

所以我从 cpan 下载了 DBD-JDBC-0.71.tar.gz 包并解压并在下面运行:

$perl Makefile.PL
Checking if your kit is complete...
Looks good
Using DBI 1.643 (for perl 5.028001 on x86_64-linux-thread-multi) installed in /root/.cache/activestate/20d7a5e1/lib/perl5/site_perl/5.28.1/x86_64-linux-thread-multi/auto/DBI/
Generating a Unix-style Makefile
Writing Makefile for DBD::JDBC
Writing MYMETA.yml and MYMETA.json

$ make
cp lib/Bundle/DBD/JDBC.pm blib/lib/Bundle/DBD/JDBC.pm
cp JDBC.pm blib/lib/DBD/JDBC.pm
cp JDBC.pod blib/lib/DBD/JDBC.pod
Manifying 2 pod documents
$ make test
PERL_DL_NONLAZY=1 CLASSPATH=dbd_jdbc.jar:t/hsqldb/hsqldb-1.8.0.2.jar:t/hsqldb/log4j-1.2.13.jar: "/root/.cache/activestate/20d7a5e1/bin/perl-static" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0,'blib/arch')" t/*.t
t/01_env.t ...... ok
t/02_connect.t .. ok
t/03_hsqldb.t ... 2/22 # Looks like your test exited with 1 just after 22.
t/03_hsqldb.t ... Dubious,8 wallclock secs ( 0.03 usr  0.01 sys +  0.27 cusr  0.04 csys =  0.35 CPU)
Result: FAIL
Failed 1/5 test programs. 0/32 subtests failed.
make: *** [test_dynamic] Error 255

在我尝试启动 JDBC 服务器之前,我已确保满足 DBD::JDBC 的所有要求:https://metacpan.org/pod/distribution/DBD-JDBC/JDBC.pod

需要

Perl 5.8.6 或更高版本 DBI 1.48 或更高 转换::BER 1.31 与 JDK 1.4 兼容的 Java 虚拟机 JDBC 驱动程序 log4j 1.2.13

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)