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

This node falls below the community's threshold of quality. You may see it by logging in.
  • Comment on How can I get a list of Databases on my Domain

Replies are listed 'Best First'.
Re: How can I get a list of Databases on my Domain
by NetWallah (Canon) on Jul 07, 2003 at 16:14 UTC
    Not an easy task, but to get a reliable list, you would need to scan the network looking for computers listening on TCP port 1433 - these would be SQL servers (and perhaps MSDE). If you have admin authority, I believe you can open the Master database in the SQL server, to get a list of databases hosted. Scan all hard drives of all machines for *.mdb (Access databases).

    This would cover most Windows-based databases. If you care about others, such as Oracle, MySQL, DB2 etc, you have a much tougher problem.

    Looking for DSN's is not sufficient. Many peple use DSN-Less connections, so a DNS is not a reliable indicator of the existance or abasence of a database.

Re: How can I get a list of Databases on my Domain
by Mitch (Sexton) on Jul 07, 2003 at 15:33 UTC
    There might be a better way, but you can query the registry for the DSN information,

    HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\odbc.ini\DSNName

    Mitch