Daedalus Software

Home

Technical Notes

SmoothWall Mods

Links

Daedalus Development Ltd

Registered in England and Wales No: 8123893

Registered Office:
2nd Floor, Hathaway House
Popes Drive
London N3 1QF

Setting up perl DBI on Linux Mandrake 7.2 to connect to a DBI proxy server running under Windows

DBI is a module for Perl that allows a standard, simple interface to a variety of databases. A DBI proxy server is a server that listens on a particular port for incoming connections, and then makes DBI database connections from the server to the database.

Since there are builds of Perl that run under Microsoft Windows, it is therefore possible to have a DBI proxy server running on a Windows machine that makes a Windows ODBC connection to a database. Any client on any platform that runs Perl can then connect to the proxy server.

This is a convenient way of connecting from a Linux machine to a database running on a Windows platform, if there are no direct DBI drivers available. (N.B. The proxy server may be running on the same server that the database is running on.)

Linux Mandrake 7.2 includes an RPM for perl-DBI, but this will not connect to a proxy server without the Storable, Net-Daemon and PlRPC Perl modules, for which there are no Mandrake RPMs available. These modules can be downloaded from CPAN.

In this particular case, we are trying to connect to a DBI proxy server running under Windows. The proxy server is running using ActiveState's ActivePerl build 509, with the DBI, Storable, Net-Daemon and PlRPC packages installed.

Unfortunately, the version of the Storable module that is distributed by ActiveState is 0.6.11 - and the proxy server will not accept connections from a machine with a later version of Storable. This means that version 0.6.11 or earlier of Storable must be installed. Try www.mirror.ac.uk for this version.

One problem you may get when trying to install any Perl module under Linux Mandrake 7.2 is the following error message:

[root@server Storable-0.6.11]# perl Makefile.PL
Error: Unable to locate installed Perl libraries or Perl source code

It is recommended that you install perl in a standard location before
building extensions. Some precompiled versions of perl do not contain
these header files, so you cannot build extensions. In such a case,
please build and install your perl from a fresh perl distribution. It
usually solves this kind of problem.

(You get this message, because MakeMaker could not find "/usr/lib/perl5/5.6.0/i368-linux/CORE/perl.h")

In this case, you need to install the perl-devel RPM that is on the Mandrake 7.2 Extensions CD (this can also be downloaded from www.mirror.ac.uk).

The other error that occurs is when you do a make test whilst building the PlRPC module. The following output occurs:

[root@server PlRPC-0.2012]# make test
PERL_DL_NONLAZY=1 /usr/bin/perl -Iblib/arch -Iblib/lib -I/usr/lib/perl5/5.6.0/i386-linux -I/usr/lib/perl5/5.6.0 -e 'use Test::Harness qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t
t/base..............ok
t/client............Use of uninitialized value in concatenation (.) at t/lib.pl line 30.
Use of uninitialized value in concatenation (.) at t/lib.pl line 31.
Use of uninitialized value in concatenation (.) at t/lib.pl line 32.
FAILED tests 1-10
                 Failed 10/10 tests, 0.00% okay
t/compress..........skipped test on this platform
t/crypt.............skipped test on this platform
t/methods...........Use of uninitialized value in concatenation (.) at t/lib.pl line 30.
Use of uninitialized value in concatenation (.) at t/lib.pl line 31.
Use of uninitialized value in concatenation (.) at t/lib.pl line 32.
FAILED tests 1-9
                Failed 9/11 tests, 18.18% okay
Failed Test  Status Wstat Total Fail  Failed  List of failed
------------------------------------------------------------------------------- t/client.t                   10   10 100.00%  1-10
t/methods.t                  11    9  81.82%  1-9
2 tests skipped.
Failed 2/5 test scripts, 60.00% okay. 19/24 subtests failed, 20.83% okay.
make: *** [test_dynamic] Error 29

I have not been able to find a fix for this problem. The same module compiles correctly under SuSE 6.0. As far as I can tell, this does not stop the DBI client from working, although of course you should test all the functionality you need yourself.

Once these modules have been installed, you should be able to connect to the DBI proxy server from any Perl script in the usual fashion.