How to install Perl's Sybase DBD modules

You can't use CPAN to install the DBD::Sybase Perl drivers on Linux. There are a couple things that need to be tweaked by hand.

1. Download FreeTDS from http://www.freetds.org/. This a free alternative to Sybase's ct-lib library packages (which I couldn't find anywhere on their web or ftp sites, and which I wasn't willing to install the whole DB just to get).

2. Build FreeTDS: './configure --prefix=/usr/local/freetds; make; make install'.

3. Open /usr/local/freetds/etc/freetds.conf and add a section for the server you're using. An example:

      # This is an example Sybase server
      [SYBASE_EXAMPLE]
          host = sybase.example.com
          ;host = 192.168.1.125
          port = 2025
          tds version = 5.0

   You'll use the string 'SYBASE_EXAMPLE' in your perl scripts as the server to connect to, like so:

      my $dbh = DBI->connect("DBI:Sybase:server=SYBASE_EXAMPLE",'user','pass');

4. Download the DBD::Sybase tarball from http://search.cpan.org/CPAN/authors/id/M/ME/MEWP/DBD-Sybase-0.95.tar.gz. (The online docs are at http://search.cpan.org/author/MEWP/DBD-Sybase-0.95/Sybase.pm.)

5. Edit DBD::Sybase's dbdimp.c (it's in the top of the untarred directory), and change every cs_ctx_global() you find to cs_ctx_alloc(). There are probably four occurences to change, so do a global search and replace.

6. Edit DBD::Sybase's CONFIG file (it's also right on top there). Add the following lines:

      SYBASE=/usr/local/freetds
      EXTRA_LIBS=-linsck

7. Do the standard 'perl Makefile.PL; make; make install'.

8. Run a test script to make sure it all works.

Comments for: How to install Perl's Sybase DBD modules

Post a comment
Name:


Email Address:


URL:


Comments:


Remember info?