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;
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank You very much!
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;