Search code examples
perljdbcdbidbd

Perl JDBC Module usage issue from CPAN


I am trying to install and use DBD::JDBC module from CPAN and getting into issues . Any PERL expert in forum can help me point out what is the issue ?

I am using all below operations using root.

This is my PERL and CPAN version and prove on DBD::JDBC module installed:

$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.

Here is where JDBC failing :

$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.

Looking at below I don't see much info : /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, 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.
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.

So it seems failing at make test Step.

So I downloaded DBD-JDBC-0.71.tar.gz package from cpan and extracted and ran below :

$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/lib', '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, 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,  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

I have made sure all this requirement for DBD::JDBC is fulfilled before I try to start JDBC server as stated in the document : https://metacpan.org/pod/distribution/DBD-JDBC/JDBC.pod

REQUIRES

Perl 5.8.6 or higher DBI 1.48 or higher Convert::BER 1.31 Java Virtual Machine compatible with JDK 1.4 A JDBC driver log4j 1.2.13


Solution

  • This is a long standing issue, RT 124653. It looks like there is a hard-coded exit 1. Get rid of that and the test pass. I've not looked at the code though.

    You did most of the process right, but also remember to check the existing issues with any software to see if someone has reported the same problem. I wish I would remember to do that earlier because I often do needless work before I check and find out someone has the solution already. :)