NAME

MyDBI -- example sub-class of DBIx::DWIW

SYNOPSIS

use MyDBI;

my $db = MyDBI->Connect();

## do stuff

See DBIx::DWIW for the functions available to the $db object.

This is the sample MyDBI.pm distributed with DBIx::DWIW.

DESCRIPTION

This package knows many named database configurations (they're like ODBC DSNs in the Windows world, if that helps you at all). They have names like Finance, Games, Homer, etc., with Homer being the default. To access another, use something like:

my $db = Finance::DBI->Connect('Games');

Note that if you use the single argument form of Connect(), which we highly recommend, you are specifying a configuration name, not necessarily a database name. That is, configuration names and database names may not necessarily be related. You might have a database called Homer on two servers, test and production. You might defined a configuration named Homer-test and one called Homer-prod to make things clear. The two may only differ in the host they connect to.

The configuration name internally supplies a host, user, password, and database name. Using these gives us the flexability to move/rename databases, servers, and make other changes without having to update lots of code.