How can I connect to Sybase with Perl?

I am trying to use a good Perl module to connect to a Sybase database.

My Googling made me see it sybperlas a possible option, but it has not been updated since 2005.

+3
source share
3 answers

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.

+11
source

I found DBD :: Sybase the best module to use for Sysbase DB and Sybase :: DBlib - Sybase database API.

+1
source

Perl ODBC sybase linux (64 ) -

Sybase Open Client ODBC. ( ASE SDK ASE)

odbc, unixODBC

, -

[Adaptive Server Enterprise]
Description = Sybase ODBC Driver
Driver = /sybase/DataAccess64/ODBC/lib/libsybdrvodb.so
FileUsage = -1

Here is an example of perl -

#!/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 instructions, see http://kapilraju.tumblr.com/post/131288341356/connect-to-sybase-using-perl-odbc

0
source

Source: https://habr.com/ru/post/1747358/


All Articles