Connecting to SQL with Perl on Apache 
Author Message
 Connecting to SQL with Perl on Apache
Can anyone help me connect to SQL6.5 with Perl5, running off an Apache
server on a FreeBSD box?

Please, any advice is welcome.


Sat, 28 Jul 2001 03:00:00 GMT
 Connecting to SQL with Perl on Apache


> Can anyone help me connect to SQL6.5 with Perl5, running off an Apache
> server on a FreeBSD box?

Q.      How do I connect to SQL Server from a non-microsoft machine?  E.g. Unix, Macintosh etc.
(v1.6 1999.02.09)

A.      Ok, this isn't one with a straight answer.  Microsoft don't support or supply connectivity from
non-DOS/Windows/NT machines any longer, so you have to go to a 3rd party vendor.  The choices are :-

1.  You can try acquiring/licensing/using a Sybase Open CT-Lib/Db-lib client if one exists for your operating
system.  Sybase supply drivers for many non-MS operating systems.  The downside is that Sybase's and MS's usage
of the base TDS protocol has been diverging ever since the 4.x versions of SQL Server they both released.  Since
then 6.0, 6.5 and especially 7.0 of MS's code, and versions 10, 11 and above of Sybase's code mean that Sybase's
CT-Lib's may or may not work for you.  You may need to get an old version from Sybase (maybe an original 4.x
db-lib) and it may not support all the functionality you need.  It certainly won't be supported.  There are
several reports of working connections to 6.5 servers failing when they were upgraded to 7.0.

2.  You could reverse engineer the undocumented TDS protocol yourself.  This could and does change between
versions of SQL Server, so only attempt this if you want an on-going maintenance challenge.  Several people have
done such reverse engineering for the portions of TDS they needed and have reported it's not that difficult.  
Once such is the FreeTDS project that is reverse engineering the TDS specification and is currently implementing
CTLIB, DBLIB, and JDBC interfaces for TDS.  ODBC and Perl DBD drivers are planned.  The FreeTDS JDBC driver is a
type 4 driver and should work on any JVM.  The CTLIB and DBLIB interfaces are known to compile under AIX, Linux,
and FreeBSD without any problems.  More info from .  The mailing list archive
can be viewed at

3.  If you don't mind accessing SQL from Perl, then there is a SybPerl and also an ODBC Perl interface available
from standard CPAN sites.  Just do a web search for the nearest one.  (Note that SybPerl is designed for Sybase
really so you may have the same compatibility problems as with CT-Lib)

4.  The recommended option is that you acquire an ODBC/OLE-DB driver from a driver vendor that will offer
on-going support.  However, many ODBC vendors have either moved from pure client drivers to "3-tier" driver
systems which many people don't want, or they have moved from ODBC into OLE-DB.  Therefore you may have trouble
finding just what you want.  (Success and failure stories welcome - but be persistent with whichever vendors you
talk to - they may not be actively advertising what you want, but that doesn't mean they don't still have old
copies of it buried in a cupboard somewhere).

Vendors to try are (in no particular order) :-

        Microfocus   (used to be Intersolv)

The best overrall lists of ODBC/JDBC/OLEDB vendor's I know is run by Ken North :-

You can download a Visigenic ODBC version 2.1.2 for the Macintosh from (they produce a DAL/ODBC DBMS
called PrimeBase).

 Neil Pike MVP/MCSE.  Protech Computing Ltd
 (Please post ALL replies to the newsgroup only unless indicated otherwise)
 For SQL FAQ entries see
 and GO MSSQL Lib 1 on Compuserve

Fri, 03 Aug 2001 03:00:00 GMT
 [ 2 post ] 

 Relevant Pages 

1. Apache/PHP/Informix and Apache/Perl/Informix

2. connecting to SQL Server 7 from Linux / Apache / PHP

3. problem in module Pg with Apache, Perl and SSL

4. problem in module Pg with Apache, Perl and SSL

5. Choosing DBMS: friendly to Linux, Apache, Perl, Java

6. Perl-Oracle-Apache userid problem

7. Apache Perl and Oracle

8. Persistant connection using Apache and Perl

9. Connecting SQL*Net and Net8 (Apache and Oracle)

10. Perl add-on libraries and Apache

11. SE 7.2 on apache webserver using perl DBD concurrent license

12. SE 7.2 on apache webserver using perl DBD concurrent license question

Powered by phpBB® Forum Software