MSSQL::OlleDB 2.000

Brief Overview

MSSQL::OlleDB is a module that permits you to access SQL Server from Perl, by using any of the OLE DB providers SQLOLEDB or SQL Native Client. OlleDB exposes two levels of interface, a high-level interface and a mid-level interface. The high-level interface is a developed version of the interface of my older module MSSQL::Sqllib, and largely backwards compatible with this interface. The mid-level interface exposes a few more knobs at the price of somewhat more verbose code. A special feature of MSSQL::OlleDB is that there is a big focus on control of error handling.

There is no support for DBI. This module does not run on Unix – or any other non-Windows OS for that matter.

What's in This Kit

The zip file includes x86 binaries for ActivePerl 809 or later as well as source code and test scripts. If you want to run this on 64-bit machine, you will either have to use the x86 binary, or build from sources. (I have not tested any of these options.) For information on how to build from sources, see below. The kit also includes a copy of MSVCR70.DLL.

The binaries were built on Windows XP SP2 with the Visual Studio 2002 C++ compiler and build 809 of ActivePerl.


For details, see the Prerequisites section in the MSSQL::OlleDB manual.

How to Install the Binary

To test that the installation is OK, either run any of the test scripts that comes with OlleDB and which are detailed in tests.html, or run any of the sample scripts in the MSSQL::OlleDB manual.

Note that beside the OlleDB DLL, the script will also place a copy of MSVCR70.DLL in the directory Site\Auto\Mssql\OlleDB. As I understand it, this is the recommended procedure for modules built with Visual C++ 7.0 or later.


The manual is in mssql-olledb.html. also installs is under html/site/lib/MSSQL as OlleDB.html. There is a POD file as well, but there is no real contents in it, only a pointer to the HTML file.

Reporting Bugs or Problems

Please mail bug reports and suggestions to Try to make your reports as specific as possible. Particularly do not forget to include which versions of Perl, Windows, SQL Server etc you are using.

I usually try to respond within 24-48 hours, but if I am on holiday I am.

Building from Sources


To build MSSQL::OlleDB you need:

How to Build and Install

Text in this type face indicates command you run from the command prompt.

  1. Extract the zip file anywhere you like.
  2. Edit so that $SQLDIR points to where sqlncli.h is located.
  3. also includes a dynamic_lib option, which I don't know whether it will work with other compilers than Visual C++. For better startup performance, you are encouraged to find the corresponding command-line option for your compiler. However, you can remove it if you don't care.
  4. Open a Command Prompt, and change directory to where you extracted the files.
  5. Perl
  6. MAKE
    Or NMAKE, DMAKE or whatever your MAKE utility you use.
  7. MAKE test
    Before you run the tests, please read tests.html so that you understand what impact the test scripts have on your server. This document also describes how to set the environment variable OLLEDBTEST, from which the test scripts get information how to log into SQL Server.
  8. MAKE install

Last updated 05-11-13 18:30