Sybase::FAQ -- The Frequently Asked Questions for Sybase access from Perl.
perldoc Sybase::FAQ
This document serves to answer the most frequently asked questions on the sybperl-l mailing list.
sybperl is the collective name for a set of perl modules that provide access to the Sybase Open Client API. It was originally released in September 1991 as an add-on to perl 4.xx, and has since been re-written for perl 5 (around 1995).
DBD::Sybase is a driver module for DBI - see http://search.cpan.org/~timb/DBI-1.40/DBI.pm.
The sybperl and DBD::Sybase modules are supported via the sybperl-l@peppler.org mailing list. You can subscribe to the mailing list by sending an email with ``subscribe'' in the body to sybperl-l-request@peppler.org. The mailing list is archived and searchable at http://www.peppler.org/archive.
Before installing sybperl or DBD::Sybase you need to have the Sybase Open Client libraries available. The installation scripts look for these files using the SYBASE and SYBASE_OCS environment variables. The easiest way to install sybperl or DBD::Sybase is to use the CPAN module:
perl -MCPAN -e shell cpan> install Sybase::CTlib
On a Unix system you will probably need to be root to run this command.
Typical error:
cc -c -I/apps/sybase/include -xO3 -xdepend -DVERSION=\"2.14\" -DXS_VERSION=\"2.14\" -KPIC -I/usr/perl5/5.00503/sun4-solaris/Cc
cc: unrecognized option `-KPIC'
cc: language depend not recognized
cc: CTlib.c: linker input file unused because linking not done
Several systems (Solaris 8 and later, recent versions of IRIX) come with a prebuilt copy of perl. This is usually built with the extra-cost compiler (Forte-C for Sun, for example). Perl records the details that are needed to compile modules in its Config.pm file, and these details are in general fairly compiler specific. If you do not have the compiler that was used to build perl then it is very likely that you won't be able to build sybperl (or any other binary module) with a different compiler (typically gcc).
It is sometimes possible to hack perl's Config.pm file to fix this sort of error - but I really don't recommend it.
Instead, download the perl source from http://www.perl.org/ or one of its mirrors, and build perl from source.
There can be several reasons for this.
A symptom of an incorrect LD_LIBRARY_PATH looks like this:
t/autocommit....ld.so.1: /usr/local/bin/perl: fatal: relocation error: file /attila/openclient/lib/libtli.so: symbol comn_yield: referenced symbol not found
where the clue is the
symbol comn_XXXX: referenced symbol not found
(note that the actual symbol that is missing depends on the version of the library and the sybperl or DBD::Sybase version).
t/2_ct_ctlib...........Can't load '/.cpan/build/sybperl-2.16/blib/arch/auto/Sybase/CTlib/CTlib.so' for module Sybase::CTlib: ld.so.1: /bin/perl: fatal: relocation error: file /.cpan/build/sybperl-2.16/blib/arch/auto/Sybase/CTlib/CTlib.so: symbol blk_drop: referenced symbol not found at ...
You need to complain to Sybase to get the missing libblk.a library, and then rebuild.
select @@version)
from the database server during the DBI->connect() call so that it
can enable/disable certain features.
This request ends with a $sth->finish() call, which normally maps to
a ct_cancel() call. Certain versions of Open Client this call hangs.
Adding syb_flush_finish = 1> to the connection attributes usually
solves the problem:
$dbh = DBI->connect("dbi:Sybase:server=foo", $user, $pwd, { syb_flush_finish => 1 });
The short answer is yes.
The long answer: the newer features (such as wide varchar columns, support for DATE and TIME columns) is only be available in recent versions of sybperl (2.15 and later), and then only if you also built sybperl against a copy of Open Client that supports these features. Furthermore you should not use a sybperl binary with different OpenClient installation from the one used when it was built due to potential binary incompatibilities.
Michael Peppler, with data from the sybperl-l mailing list.