Link to home
Start Free TrialLog in
Avatar of CWL
CWL

asked on

How to connect Sybase with perl?

I have try to connect the Sybase with the program as follow:

However, the server reply that the Sybase/DBlib is not found and cause the compilation error.

Can anyone tell me how and where to get the DBlib and CTlib?
Is there any special condition to install these library since i am not the system admin?

Also, can anyone give me some code (or sample code that can connect to the Sybase)?
Thank you very much!

The following is my code:

#!/usr/local/bin/perl

print "Content-type: text/html\n\n";

use Sybase::DBlib;
$dbh = new Sybase::DBlib 'user', 'password';
$dbh->dbcmd("select name, category from product");
$dbh->dbsqlexec;
$dbh->dbresults;
while(@data = $dbh->dbnextrow)
{
      foreach $data (@data)
      {
            print $data;
      }
}

exit;
ASKER CERTIFIED SOLUTION
Avatar of b2pi
b2pi
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry, additionally, if you can't get your administrator to install it properly, follow the following to install it locally.

1.) unpack the distribution someplace reasonable.
2.) Determine where you want it to go (say ~/sybperl)
3.) from the unpacked directory, give the command

perl -Makefile.PL LIB=~/sybperl

4.) After reading the readme file, and adjusting files according to instructions therein, give the commands:

make
make test
make install

5. In your code, use

use lib '~/sybperl';

before the

use Sybase::DBlib;

Avatar of CWL
CWL

ASKER

Thank You very much!