sebastiaopburnay has asked for the wisdom of the Perl Monks concerning the following question:

Hi!

First of all, let me thank you for your time and knowledge sharing, I'm kind of an ignorant in trems of perl modules

I have a 64bit ubuntu Server 12.04, with Perl version 14, subversion 2 (v5.14.2) built for x86_64-linux-gnu-thread-multi and CPAN exploration and modules installation (v2.10).

I'm trying to use a perl script accessing a Microsoft SQL Server and I'm having a really hard time upon the DBD::Sybase module

When I try to install DBD::Sybase CPAN tells me it's already installed

cpan[1]> install DBD::Sybase + Reading '/root/.cpan/Metadata' Database was generated on Wed, 29 Apr 2015 14:53:21 GMT DBD::Sybase is up to date (1.15).

I also find multiple Sybase.pm files on my filesystem, some of them are under Perl path

root@server:# find /* -name Sybase.pm /home/usriten/download/DBD-Sybase-1.15/Sybase.pm /root/.cpan/build/DBD-Sybase-1.15-TtUI0T/Sybase.pm /root/.cpan/build/DBD-Sybase-1.15-kNqdf7/Sybase.pm /root/.cpan/build/DBD-Sybase-1.15-rZgcTa/Sybase.pm /usr/local/lib/perl/5.14.2/Sybase.pm /usr/local/lib/perl/5.14.2/DBD/Sybase.pm /usr/local/lib/perl/5.14.2/DBI/Sybase.pm

But when I try to run my script it returns an error on a line that calls 'if ($self->{handle} = DBI->connect('

# ./check_mssql_health --hostname <MSSQL_Server_IP> --username <SQL_Us +er> --password <Pass> --mode connection-time CRITICAL - cannot connect to <MSSQL_Server_IP>. install_driver(Sybase) + failed: Can't locate loadable object for module DBD::Sybase in @INC +(@INC contains: . /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/sha +re/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /us +r/share/perl/5.14 /usr/local/lib/site_perl) at (eval 10) line 3 Compilation failed in require at (eval 10) line 3. Perhaps a module that DBD::Sybase requires hasn't been fully installed at ./check_mssql_health line 3192

I've already spent a lot of time scavenging posts but I did not find a solution or at least one I could understand and Implement.

Best regards, Sebastião

Replies are listed 'Best First'.
Re: DBD::Sybase error
by jeffa (Bishop) on Apr 29, 2015 at 16:46 UTC

    Just as a reference: Can't locate loadable object for module DBD::Sybase looks to be unresolved ... edimusrex's suggestion seems like a good idea, but you should be able to configure the CPAN install to find the correct libraries. (See this reply for more hints if the apt-get suggestion doesn't work.)

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    
Re: DBD::Sybase error
by edimusrex (Monk) on Apr 29, 2015 at 16:38 UTC
    Have you tried installing the module via apt?
    sudo apt-get install libdbd-sybase-perl -y

    I would try that first. I've seen some weird instances where cpan doesn't link everything up correctly. I try to use as many apt controlled perl packages as possible to eliminate this frustration

      Thank you for your suggestion on installing the module via apt-get; the module was indeed installed after I added the '--force-yes' flag

      Yet, I now have a different error that seems to me like some kind of conflict:

      root@server:# ./check_mssql_health --hostname <MSSQL_Server_IP> --user +name <MSSQL_user> --password <MSSQL_pass> --mode connection-time CRITICAL - cannot connect to <MSSQL_Server_IP>. install_driver(Sybase) + failed: DBD::Sybase object version 1.14 does not match bootstrap par +ameter 1.15 at /usr/lib/perl/5.14/DynaLoader.pm line 207. Compilation failed in require at (eval 10) line 3. at ./check_mssql_health line 3192

        I suppose it's possible that the version under apt is 1.14 and the version that cpan partially installed was 1.15. What I would do is remove the package from cpan and apt and try reinstalling just the apt version.

        After that try

        sudo apt-get autoremove && sudo apt-get install libdbd-sybase-perl -y

        Basically try to clean up some of the mess.

Re: DBD::Sybase error
by BaldManTom (Friar) on Apr 29, 2015 at 22:36 UTC

    Hi sebastiaopburnay

    In addition to the above suggestions, you'll want to make sure that you're running with the same interpreter that your DBD::Sybase module is installed to. From a command prompt, type which perl and then compare it to what's on the first line of your script. If they don't match, you've got a problem. You could solve it by a) updating that first line to match the location that which perl spits out, b) change that first line to #! /usr/bin/env perl or c) invoke your script by using perl <script> [options].