Enumerate SQL Servers using OLE-DB
updated: 1 February 2003
platform: SQL Server 2000 running Windows NT 4.0 and higher
Enumerate SQL Server instances on the
network using the OLE-DB CLSID_SQLOLEDB_ENUMERATOR.
This sample shows how to use the SQL
enumerator, part of the SQL Server OLE-DB provider to retrieve instances of SQL
Server available on the network.
The OLE-DB enumerator relies on the
same UDP broadcast technique as the ODBC SQLBrowseConnect implementation. This means it will never be able to
return a conclusive or complete list of SQL Server instances because:
Instances that are not up and running
do not respond to the discovery broadcast. Only one instance has to be up on a
machine, it can respond for all instances on a machine
Instances might respond after the
timeout, which will exclude there response from the list
Instances might not be listening on
the correct protocol, so will never receive the discovery broadcast
Network infrastructure, especially
routers, might limit the effect/visibility of the broadcast, since most routers
are configure not to relay broadcast request to the other side of the router.
NOTE: The OLE-DB
implementation can not return any of the extended information, like
Simply copy OleDbEnum.exe onto your machine.
OleDbEnum-src.zip (Visual C++ 7.0 project)
MDAC 2.6 or higher, which is the MDAC version that is shipping with
SQL Server 2000.
Planned functionality enhancements: