Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Retrieving the names of SQL Servers in the network

0 views
Skip to first unread message

Wolfgang Seyen

unread,
Oct 28, 1999, 3:00:00 AM10/28/99
to
Hi group!

I'm looking for a way to enumerate all running SQL Server in my network.
Does anyone know i can do this in VB 6.0?

Thanks

Wolfgang

Neil Pike

unread,
Oct 28, 1999, 3:00:00 AM10/28/99
to
Wolfgang,

> I'm looking for a way to enumerate all running SQL Server in my network.
> Does anyone know i can do this in VB 6.0?

Q. Where does the list of SQL Server's come from in registration/dialog
boxes? What reasons are there for not getting a list?
(v1.1 1999.09.09)

A. When SQL Server starts up it "registers" itself with the network. The list
of workstations/servers/etc is held in a browser list which is normally
maintained by the domain controllers. You can also use the SQLBrowseConnect
api.

A client needing a list of resources - in this case SQL Servers - issues
NetEnumXXXX commands to get the list back - this is provided by whichever
server running as a browser master has the info. For more details on browsing
see the NT resource kits.

Some restrictions :-

1. The client side Win32 named pipe Net-Library (DBNMPNTW.DLL) does not
support server enumeration on Windows 9x-based computers. This means you won't
see a list from a Win9x client.

2. There is no support for server enumeration with the Multi-Protocol
Net-Library. Any server just running multi-protocol will not be visible.

Neil Pike MVP/MCSE. Protech Computing Ltd
(Please reply only to newsgroups)
SQL FAQ (348 entries) see
sqlfaq.zip in lib 1 @ http://go.compuserve.com/sqlserver
or www.ntfaq.com/sql.html (+ ntfaq download)
or http://www.swynk.com/faq/sql/sqlserverfaq.asp
or http://www.sql-server.co.uk

Darren Green

unread,
Oct 28, 1999, 3:00:00 AM10/28/99
to
In article <OeBFgHUI$GA.248@cppssbbsa05>, Wolfgang Seyen
<wse...@integriert.de> writes
>Hi group!

>
>I'm looking for a way to enumerate all running SQL Server in my network.
>Does anyone know i can do this in VB 6.0?
>
>Thanks
>
>Wolfgang
>
>

Something I picked up from a previous post some time ago -

this code comes from vbpj tip of the week and uses SQL dmo object..
<--------------------->
To enumerate all network-visible SQL servers using SQL-DMO objects,
create a
new standard EXE project and add a reference to sqldmo.rll. This file
can be
found in \Binn\Resources\1033\sqldmo.rll under the SqlServer70
directory.
Now add this code and declaration in your form's code:

Private Function GetAllSqlServerCollection(colSqlServers As Collection)
As
Boolean
Dim intIndex As Integer
Dim oApplication As SQLDMO.Application
Dim oNameList As SQLDMO.NameList

Set oApplication = New Application
With oApplication
Set oNameList = .ListAvailableSQLServers
With oNameList
For intIndex = 1 To .Count
colSqlServers.Add (oNameList.Item(intIndex))
Next
End With
End With
Set oApplication = Nothing
GetAllSqlServerCollection = True
End Function

This code quickly fetches a list of SQL servers and can be put inside a
combo box's drop-down event to always get a refreshed list of SQL
servers on
your form.

--
Darren Green
SQL/DTS - http://www.swynk.com/friends/green/

Tibor Karaszi

unread,
Oct 29, 1999, 3:00:00 AM10/29/99
to
Note that the .ListAvailableSQLServers method will only list SQL servers in
the same domain, which you are addressing over Named Pipes (and that listens
to NP, of course).

There's a Win32 API, used by SQLDMO which enumerates the SQL Servers (I
don't recall the name of that function call). By going directly against that
function call, you can provide some other domain name.

(As always, pls correct me if I'm wrong :-).

--
Tibor Karaszi
MCDBA, MCSE, MCSD, MCT, SQL Server MVP
Cornerstone Sweden AB
Please reply to the newsgroup only, not by email.


Darren Green <dgr...@shortie.demon.co.uk> wrote in message
news:OVidIIA+...@shortie.demon.co.uk...

0 new messages