On Sep 26, Dan Anderson scribed:

> I am trying to create a CGI perl script that uses DBI.  I want to allow
> it to use any database supported by DBI without having to code for
> anything more then mySQL.  Is this possible?
>
> Will I need to include all supported DBI modules (or is it DBD?) with my
> script?  How would I set something like this up?
>
> Thanks in advance,
>
> -Dan
>

I use DBI in a script to connect to both Oracle and MySQL concurrently.
The one major problem I ran into was the differing SQL dialects.  For
instance, the format of an outer join is different ((+) in Oracle, LEFT
OUTER JOIN ... ON ... in MySQL).  Other than that, just changing the
connect string was enough:

use DBI;
my $dbh1 = DBI->connect("dbi:Oracle:database1", "user", "pass");
my $dbh2 = DBI->connect("dbi:mysql:database2", "user", "pass");

I have both DBDs installed, but they are only specified in the connect()
string.

HTH,
Dave

Reply via email to