I'm trying to a good Perl module to use for connecting to a Sybase database.
My Googling has led me to see sybperl
as a possible choice, but it hasn't been updated since 2005.
Use DBD::Sybase (via DBI). I use this regularly with FreeTDS to connect to SQL Server, but it is actually written against the CT-Lib interface for Sybase.
我发现DBD :: Sybase是用于Sysbase DB和Sybase :: DBlib的最佳模块 - Sybase DB-Library API。
Here is how you connect using perl with ODBC to sybase on linux(64 bit)-
Install Sybase Open Client and ODBC driver. (You can get these two from ASE SDK or from ASE server installation)
You need a odbc driver manager, i have tried with unixODBC
Define a driver config like -
[Adaptive Server Enterprise]
Description = Sybase ODBC Driver
Driver = /sybase/DataAccess64/ODBC/lib/libsybdrvodb.so
FileUsage = -1
Here is a perl sample -
#!/usr/bin/perl
use strict;
use DBI;
use DBD::ODBC;
BEGIN {
$ENV{SYBASE} = "/sybase";
}
my $user = "";
my $passwd = "";
my $server = "";
my $database = "pubs1";
my $port = "5000";
my $data_source = "DBI:ODBC:DRIVER={Adaptive Server Enterprise};server=$server;port=$port;database=$database;";
my @drivers = DBI->available_drivers;
print join(", ", @drivers), "\n";
my $dbh = DBI->connect($data_source, $user, $passwd)
or die "Can't connect to $data_source: $DBI::errstr";
my $statement = "SELECT * FROM <table_name>";
my @row = $dbh->selectrow_array($statement);
print "@row\n";
$dbh->disconnect;
For detailed steps, see - http://kapilraju.tumblr.com/post/131288341356/connect-to-sybase-using-perl-odbc
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.