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!" |