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.


In reply to Re^8: DBD::Sybase make problem by ashok.g
in thread DBD::Sybase make problem by ashok.g

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.