[ TOC ]

Getting at your data on Windows with Perl

Preface

Some of us like Windows, and others of us have Windows thrust upon us. If you fall into the latter category, you may find some useful things in my collection of things to make NT more usable. If you fall into the former category, I hear that there are doctors that can help you.

When I first started writing CGI code on Windows machines, the only way to talk to ODBC databases was with David Roth's Win32::ODBC module. (No, not that David Roth!) It provides a very easy-to-use interface to any ODBC-compliant database, such as Access, MS SQL Server, or any of the numerous other databases that run on the Windows platforms.

The way to do things now is DBI - the Perl database interface. DBI is database independent, so that you can write code once, and run it on any database. There will be much more about this in the section on DBI, once I get around to writing that.

Installing Perl on Windows

There used to be two distinct builds of Perl available for Windows machines. There was the version from ActiveState (formerly ActiveWare, formerly Hip Communications), and there was the version from Gurusamy Sarathy. The former was easier to install. The latter came with a larger number of the standard modules, notably the Tcl stuff. The main problem that this created was that there were some modules that were only available in binary form for one or the other of these builds, and folks that had Windows machines without compilers were rather stuck.

A few months ago, Gurusamy went to work at ActiveState, and there was much rejoicing.

So, grab ActivePerl from ActiveState, and install it.

Installing the necessary modules

Installing modules is now a lot easier than it used to be on Windows machines, particularly for those of you who don't have a compiler available on your Windows machines.

Open a DOS prompt, and change to the bin subdirectory of wherever you installed Perl. Type "perl ppm.pl". (If you have the perl bin directory in your path, you can just type ppm.) This will launch an interactive shell with a prompt that looks like:

PPM> 
At the prompt, you can type various commands. For database access, there are several modules that you might want, so we'll install all of them now. Type "install Win32-ODBC", and answer "y" when asked if you want to install it. Similarly, type "install DBI" and "install DBD-ODBC" to install those modules.

Note that this PPM (Perl Package Manager) installs these modules by making a socket connection out to the Internet, to www.activestate.com, to get those install files. If you are on an unconnected machine, or have a restrictive firewall, this could cause some problems.

For more details on installing Perl modules on NT, see Installing Perl Modules on NT.

[ TOC ]