Tuesday, March 27, 2012

Enumerate SQL servers?

I'm working on an Access app that will have a SQL 2K backend. My setup will
install MSDE, and I will set the sa password, etc. which I don't want the
end user's to know. My problem is in Relinking the ODBC tables once it is
installed in the field. The one item I won't know is the name of the server
MSDE is installed on. I want to prompt the user to pick the server from a
list, much like you do when creating a DSN through the ODBC Administrator. I
can't use the ODBC Administrator to create a DSN because if the user doesn't
enter the sa password, it fails; also, I want to use DSN-less connections.
But I can't seem to find an API call to enumerate the SQL servers available
on the network. Does anyone know of an API to call? Alternatively, some code
to enumerate SQL servers running on the LAN? TIA!Can also look at :
http://www.extremeexperts.com/sql/f...istServers.aspx
HTH,
Vinod Kumar
MCSE, DBA, MCAD, MCSD
http://www.extremeexperts.com
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp
"Ron Hinds" <__NoSpam@.__NoSpamramac.com> wrote in message
news:%23rKHj4H3DHA.1392@.TK2MSFTNGP11.phx.gbl...
quote:

> I'm working on an Access app that will have a SQL 2K backend. My setup

will
quote:

> install MSDE, and I will set the sa password, etc. which I don't want the
> end user's to know. My problem is in Relinking the ODBC tables once it is
> installed in the field. The one item I won't know is the name of the

server
quote:

> MSDE is installed on. I want to prompt the user to pick the server from a
> list, much like you do when creating a DSN through the ODBC Administrator.

I
quote:

> can't use the ODBC Administrator to create a DSN because if the user

doesn't
quote:

> enter the sa password, it fails; also, I want to use DSN-less connections.
> But I can't seem to find an API call to enumerate the SQL servers

available
quote:

> on the network. Does anyone know of an API to call? Alternatively, some

code
quote:

> to enumerate SQL servers running on the LAN? TIA!
>
|||Hi Vinodk,
I can list SQL server instances on my personal computer fairly easily using
SQLBrowseConnect and associated methods but I have trouble trying to
enumerate all SQL servers on the network if I am not connected to a browser
service. Obviously, I don't expect to get a list of servers if I am not
connected but I can't seem to get a *faster* way to check if I am connected
to the browser service.
I use something like the folowing to see if any master browsers are
available in hopes for speed bit it is very slow. If the status return
ERROR_NO_BROWSER_SERVERS_FOUND, I don't want to go further.
nStatus = NetServerEnum(NULL,
(DWORD)100,
(LPBYTE *) &pBufServerBrowser,
dwPrefMaxLen,
&dwEntriesRead,
&dwTotalEntries,
SV_TYPE_DOMAIN_MASTER |
SV_TYPE_POTENTIAL_BROWSER |
SV_TYPE_BACKUP_BROWSER |
SV_TYPE_MASTER_BROWSER,
NULL,
&dwResumeHandle);
Any thoughts on this'
Thanks in advance for any help...
Regards,
Chris H
"Vinodk" <vinodk_sct@.NO_SPAM_hotmail.com> wrote in message
news:eXEf9iL3DHA.2296@.TK2MSFTNGP11.phx.gbl...
> Can also look at :
> http://www.extremeexperts.com/sql/f...istServers.aspx
> --
> HTH,
> Vinod Kumar
> MCSE, DBA, MCAD, MCSD
> http://www.extremeexperts.com
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techin.../2000/books.asp
>
> "Ron Hinds" <__NoSpam@.__NoSpamramac.com> wrote in message
> news:%23rKHj4H3DHA.1392@.TK2MSFTNGP11.phx.gbl...
> will
the
is
> server
a
Administrator.
> I
> doesn't
connections.
> available
> code
>

No comments:

Post a Comment