in reply to Re^6: DBD::Sybase make problem
in thread DBD::Sybase make problem

echo $LD_LIBRARY_PATH
ldd Sybase.so
ldd libct.so.4

Replies are listed 'Best First'.
Re^8: DBD::Sybase make problem
by ashok.g (Beadle) on Jul 20, 2010 at 06:01 UTC

    OK. Sybase.so is missing in my $LD_LIBRARY_PATH.
    Now, I copied that library found from /tmp/DBD-Sybase-1.10/blib/arch/auto/DBD/Sybase/ to /usr/local/freetds/lib and set all the dependency libraries in $LD_LIBRARY_PATH and all those libraries have execute permissions by all.
    Here is the code after some changes:

    #!/usr/bin/perl #require "dbdsybase.pl"; BEGIN { $ENV{'SYBASE'} = '/usr/local/freetds'; $ENV{'LD_LIBRARY_PATH'} = '/usr/local/freetds/lib/:/lib/:/lib/tls/'; #$ENV{'USER'} = 'root'; } use CGI; use CGI::Carp; use DBI; my $cgi = new CGI(); print $cgi->header(); my $cgi = new CGI(); my $path='/opt/ash/netcool'; my $hostname="192.168.2.95"; my $portno="4100"; my $database_name="NCOMS"; my $db_username="root"; my $db_password="access"; print <<EOF; <html> <head> <title>DBD Sybase Connection Check</title> </head> <body> <form name="myform"> EOF foreach (sort keys %ENV) { if (($_ eq 'SYBASE')||($_ eq 'LD_LIBRARY_PATH')||($_ eq 'USER' +)) { print "$_ : $ENV{$_}<br>"; } } $ldd1=`ldd /usr/local/freetds/lib/Sybase.so`; $ldd2=`ldd /usr/local/freetds/lib/libct.so.4`; print "<h2>ldd of Sybase.so:</h2> $ldd1 <br> <h2>ldd of libct.so.4:</h +2> $ldd2 <br>"; #print "\nSyabse:$ENV{'SYBASE'}<br>LD_LIBRARY_PATH:$ENV{'LD_LIBRARY_PA +TH'}<br>"; print "<h2>**********----->$dbh<-----**********</h2>"; my $dbh = DBI->connect("dbi:Sybase:host=$hostname;port=$portno;server= +$database_name;",$db_username,$db_password) || warn "Database Connect +ion not made: $DBI::errstr"; #my $dbh = &datahandle(); print "<h2>**********$dbh**********</h2><br>"; print <<EOF; <br> </form> </body> </html> EOF
    and its output on browser is:
    LD_LIBRARY_PATH : /usr/local/freetds/lib/:/lib/:/lib/tls/ SYBASE : /usr/local/freetds ldd of Sybase.so: libct.so.4 => /usr/local/freetds/lib/libct.so.4 (0x00e92000) libdl.so. +2 => /lib/libdl.so.2 (0x00fae000) libm.so.6 => /lib/tls/libm.so.6 (0x +00402000) libc.so.6 => /lib/tls/libc.so.6 (0x00604000) librt.so.1 => +/lib/tls/librt.so.1 (0x00a13000) libpthread.so.0 => /lib/tls/libpthre +ad.so.0 (0x008c6000) /lib/ld-linux.so.2 (0x0093f000) ldd of libct.so.4: librt.so.1 => /lib/tls/librt.so.1 (0x00a8c000) libpthread.so.0 => /lib +/tls/libpthread.so.0 (0x009be000) libc.so.6 => /lib/tls/libc.so.6 (0x +00111000) /lib/ld-linux.so.2 (0x0093f000) **********-----><-----**********
    Still I'm not getting the dbi connection.
    You didn't address the problem why $DBI::errstr is not printing in the script.

    Thanks in advance.

      OK. Sybase.so is missing in my $LD_LIBRARY_PATH.

      Why do you say that, Sybase.so is not supposed to be in your LD_LIBRARY_PATH Now, I copied that library found from /tmp/DBD-Sybase-1.10/blib/arch/auto/DBD/Sybase/ to /usr/local/freetds/lib and set all the dependency libraries in $LD_LIBRARY_PATH and all those libraries have execute permissions by all.

      Didn't need to do that, weird thing to do :/

      You didn't address the problem why $DBI::errstr is not printing in the script.

      It doesn't matter, you need to resolve

      Can't load '/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/aut +o/DBD/Sybase/Sybase.so' for module DBD::Sybase: libct.so.4: cannot op +en shared object file: No such file or directory at /usr/lib/perl5/5. +8.5/i386-linux-thread-multi/DynaLoader.pm line 230. at (eval 8) line 3 Compilation failed in require at (eval 8) line 3. Perhaps a required shared library or dll isn't installed where expecte +d
      by figuring out which shared library or dll isn't installed where expected. You do that with ldd...

        Hmmm,
        I deleted the Sybase.so from freetds/lib and added /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/Sybase to LD_LIBRARY_PATH

        But, I think the problem is clear now.
        I am getting the $dbh value when running the script on console with the respective ENVs set.
        I also set the same ENVs to the same values that I set on console but unable to execute this script.
        Am I missing anything here?