in reply to dsn and underlying db

Hey AM, I can think of two ways of doing this.

The first would be to actually connect to the DSN and use the "Name" DBI database handle property to find out which database you are connected to. For example:

$dbh = DBI->connect("dbi:ODBC:DSN","user","passwd"); print "Connected to: ", $dbh->{"Name"};
The other option is a non-perl route and doesn't require connecting to the database at all. You should be able to find out the default database by going through the Windows Registry.

I'm running Windows 2000 and the path to my DSNs is:
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\
Choose your DSN and there should be a "Database" string value for that key.

HTH

~CubicSpline
"No one tosses a Dwarf!"

Replies are listed 'Best First'.
Re2: dsn and underlying db
by Hofmator (Curate) on Jun 28, 2002 at 18:40 UTC
    The other option is a non-perl route and doesn't require connecting to the database at all. You should be able to find out the default database by going through the Windows Registry.

    Well, that doesn't have to be a none non-perl way ... see Win32::TieRegistry.

    -- Hofmator