Yeah! It's all about the libraries of freetds. I exported all the libraries using LD_LIBRARY_PATH=/usr/local/freetds/lib
Now, I am able to use and execute some queries on this module. But, when I run sample cgi script, it's not going to execute.
Here is the sample code which I tried.

#!/usr/bin/perl BEGIN { $ENV{'SYBASE'} = '/usr/local/freetds'; $ENV{'LD_LIBRARY_PATH'} = '/usr/local/freetds/lib'; } 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 print "\nSyabse:$ENV{'SYBASE'}<br>LD_LIBRARY_PATH:$ENV{'LD_LIBRARY_PAT +H'}<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"; print "<h2>**********$dbh**********</h2><br>"; print <<EOF; <br> </form> </body> </html> EOF
and the corresponding output when I execute this sample code:
In console, without setting SYBASE=/usr/local/freetds and LD_LIBRARY_PATH=/usr/local/freetds/lib is
[root@station34 cgi-bin]# ./dbdsybase.cgi Content-Type: text/html; charset=ISO-8859-1 <html> <head> <title>DBD Sybase Connection Check</title> </head> <body> <form name="myform"> install_driver(Sybase) failed: Can't load '/usr/lib/perl5/site_perl/5. +8.5/i386-linux-thread-multi/auto/DBD/Sybase/Sybase.so' for module DBD +::Sybase: libct.so.4: cannot open 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 at ./dbdsybase.cgi line 29 Syabse:/usr/local/freetds<br>LD_LIBRARY_PATH:/usr/local/freetds/lib<br +><h2>**********-----><-----**********</h2>[root@station34 cgi-bin]#
In console, by setting SYBASE=/usr/local/freetds and LD_LIBRARY_PATH=/usr/local/freetds/lib is
[root@station34 cgi-bin]# ./dbdsybase.cgi Content-Type: text/html; charset=ISO-8859-1 <html> <head> <title>DBD Sybase Connection Check</title> </head> <body> <form name="myform"> Syabse:/usr/local/freetds<br>LD_LIBRARY_PATH:/usr/local/freetds/lib<br +><h2>**********-----><-----**********</h2><h2>**********DBI::db=HASH( +0x87e56cc)**********</h2><br><br> </form> </body> </html>
On browser
Syabse:/usr/local/freetds LD_LIBRARY_PATH:/usr/local/freetds/lib **********-----><-----**********
which means that the part
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"; print "<h2>**********$dbh**********</h2><br>"; print <<EOF; <br> </form> </body> </html> EOF
of the script is not executing due to connect statement. Also, why $DBI::errstr is not printing here.

Thanks in advance.


In reply to Re^4: 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.