Losing has asked for the wisdom of the Perl Monks concerning the following question:

I am writing a Database module that will provide a single interface for several different databases, including: DB2, Oracle, MySQL and SQL Server 2000/2005.

Everything is smooth so far, and the script works well for all of the databases I have tested it on. The only problem is, if this script is to run on another machine, the database drivers need to be installed.

I was wondering what the best way to make sure all of the database drivers are installed. Would it be best to create a makefile that will install my module along with all the appropriate drivers, or is there a way to do it from within my module? I am not sure what platform this needs run on, Linux or Windows, but right now it needs to work on a windows machine.

Replies are listed 'Best First'.
Re: Database drivers
by friedo (Prior) on Nov 15, 2006 at 16:55 UTC
    If you package your module up as a CPAN distribution (even if you don't intend to release it on CPAN) you can include all the database drivers you need as prerequisites (either in the Makefile.PL or Build.PL). Then you can install it via CPAN.pm, and it will go and fetch anything it needs.
      Beautiful, thank you, exactly what I am looking for.
Re: Database drivers
by Mr. Muskrat (Canon) on Nov 15, 2006 at 19:32 UTC
    What's wrong with the tried and true method of installing those things from CPAN?
    C:\> cpan cpan> install DBI cpan> install DBD::mysql cpan> install DBD::Oracle cpan> install DBD::DB2 ... ad infinitum ...
    Or go with friedo's advice. (It helps if you read the replies before replying yourself.)
Re: Database drivers
by Melly (Chaplain) on Nov 15, 2006 at 16:56 UTC

    A bit OT, but can't you turn your app into a CGI application, and then you won't have to worry?

    I sort of vaguely assuming that this is something you will be running inside a company's network...

    Tom Melly, tom@tomandlu.co.uk
Re: Database drivers
by fenLisesi (Priest) on Nov 15, 2006 at 18:23 UTC