Win32::SqlServer 2.010

Brief Overview

Win32::SqlServer is a module that permits you to access SQL Server from Perl, by using any of the OLE DB providers SQLOLEDB or SQL Server Native Client. Win32::SqlServer exposes two levels of interface, a high-level interface and a mid-level interface. The mid-level interface exposes a few more knobs at the price of somewhat more verbose code. A special feature of Win32::SqlServer is that you get fine-grained control for error handling.

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

Prerequisites

For details, see the Prerequisites section in the Win32::SqlServer manual.

If you need support for SQL Server 6.5 or Perl 5.8 or 5.10, you can use version 2.008 of Win32::SqlServer, as I have dropped support for these version in later versions of Win32::SqlServer.

Deprecation of OS Support

This far I have built Win32::SqlServer using Visual Studio 2005. For the next version I will Visual Studio 2015. This is likely to have the consequence that the binaries will not run old versions of Windows. Exactly which versions that are affected I have not investigate in detail, but if I am to believe this MSDN topic, the minimum requirement will be Windows Vista (desktop) and Windows 2008 (server).

What's in This Kit

The zip file includes x86 and AMD64 binaries for Perl 5.12, 5.14, 5.16, 5.18, 5.20, 5.22 and 5.24. The binaries have been tested with all corresponding versions of ActivePerl. The binaries for 5.18 and up have also been tested with Strawberry Perl. Note that the 32-binaries in the kit for 32-bit Perl are built with the option USE_64_BIT_INT set. They will not run with a 32-bit Perl built without this option.

The kit also includes source code and test scripts. For information how to build from sources, see below.

The binaries were built on Windows 7 with the Visual Studio 2005 C++ compiler. For Perl 5.12 to 5.16 they were built with ActivePerl. For 5.18 and up, I have used Perl installations that I built myself from the Perl source (since ActivePerl is now labelled to be built with gcc.)

Caveat: ActivePerl has a post where they say Microsoft compilers are incompatible with ActivePerl 5.18 and 5.20 and say that there are access violations etc. I have not seen any such issues (except when I tried to run without USE_64_BIT_INT), but "it seems to work". Furthermore, to get the 32-bit binaries for Perl 5.22 and 5.24 to work with Active and Strawberry Perl, I had to disable a new XS handshake in Perl, in a way that is not documented or is likely to be supported. But as I said, "it seems to work".

How to Install the Binary

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

Manual

The manual is in Win32-SqlServer.html. activeperl-copy.pl also installs it as html/site/lib/Win32/SqlServer.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 esquel@sommarskog.se. 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

Prerequisites

To build Win32::SqlServer you need:

If you want to build Win32::SqlServer with another compiler than Visual C++, you are welcome to try. I am certainly interested to know if you succeed, but I am afraid that I cannot give any help in the matter – it's way beyond my realm. (I'm an SQL Server guy, after all.)

Note that the Perl environment you build in, need to have been configured with the same compiler as you are using. That is, you cannot build Win32::SqlServer with Strawberry Perl, or ActivePerl 5.18 or later, as they are configured with gcc.

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 makefile.pl so that $SQLDIR points to where sqlncli.h is located.
  3. If you use a different compiler from Visual C++, you need to review makefile.pl more closely as makefile.pl may include options that are specific to Visual C++.
  4. Note that makefile.pl explicitly lists which libraries to link with, and specifies the MT flag for the C compiler. This is to force use of the static C run-time library for Visual C++, which is what I want for the binary distribution. Change this if you like.
  5. Open a Command Prompt, and change directory to where you extracted the files.
  6. Perl makefile.pl.
  7. MAKE
    Or NMAKE, DMAKE or whatever your MAKE utility you use.
  8. 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.
  9. MAKE install

Last updated 16-07-15 14:06