Monday, March 19, 2012
listavailablesqlservers returns only default instances - please help!
I'm trying to write an application in which I call listavailablesqlservers()
(using
SQLDMO). My intention is to get a list of all available sql server instances
available on the network (including the machine on which the app is
running). However, listavailablesqlservers() seems to return only the
default instances and ignores all other instances.
Anyone else encounter this problem or have a work around?
I'm developing using VB.NET on a Windows XP Professional machine running
both SQL Server Developer edition (my default instance) and an MSDE named
instance.
Any help would be greatly appreciated as I've unsuccessfully trawled the
Internet looking for an answer.
Thanks in advance.
Kas.Kas,
Does this help?
http://msdn.microsoft.com/library/default.asp
?url=/library/en-us/sqldmo/dmoref_p_i_95gp.asp
Russell Fields
"rearwindow" <summerof_89@.hotmail.com> wrote in message
news:bsarm9$as3$1$8302bc10@.news.demon.co.uk...
> Hiya,
> I'm trying to write an application in which I call
listavailablesqlservers()
> (using
> SQLDMO). My intention is to get a list of all available sql server
instances
> available on the network (including the machine on which the app is
> running). However, listavailablesqlservers() seems to return only the
> default instances and ignores all other instances.
> Anyone else encounter this problem or have a work around?
> I'm developing using VB.NET on a Windows XP Professional machine running
> both SQL Server Developer edition (my default instance) and an MSDE named
> instance.
> Any help would be greatly appreciated as I've unsuccessfully trawled the
> Internet looking for an answer.
> Thanks in advance.
> Kas.
>
ListAvailableSQLServers Problem
servers but it doesnt list the local machine in which SQL Server too is
running. Am i missin something?What is the local machine?
If it's xp with sp2 then see
http://support.microsoft.com/default.aspx?kbid=841249
Nigel Rivett
www.nigelrivett.net
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!|||What is the local machine?
If it's xp with sp2 then see
http://support.microsoft.com/default.aspx?kbid=841249
Nigel Rivett
www.nigelrivett.net
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!|||What is the local machine?
If it's xp with sp2 then see
http://support.microsoft.com/default.aspx?kbid=841249
Nigel Rivett
www.nigelrivett.net
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!|||What is the local machine?
If it's xp with sp2 then see
http://support.microsoft.com/default.aspx?kbid=841249
Nigel Rivett
www.nigelrivett.net
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!|||What is the local machine?
If it's xp with sp2 then see
http://support.microsoft.com/default.aspx?kbid=841249
Nigel Rivett
www.nigelrivett.net
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!|||What is the local machine?
If it's xp with sp2 then see
http://support.microsoft.com/default.aspx?kbid=841249
Nigel Rivett
www.nigelrivett.net
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!|||What is the local machine?
If it's xp with sp2 then see
http://support.microsoft.com/default.aspx?kbid=841249
Nigel Rivett
www.nigelrivett.net
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!|||What is the local machine?
If it's xp with sp2 then see
http://support.microsoft.com/default.aspx?kbid=841249
Nigel Rivett
www.nigelrivett.net
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!|||What is the local machine?
If it's xp with sp2 then see
http://support.microsoft.com/default.aspx?kbid=841249
Nigel Rivett
www.nigelrivett.net
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!|||no its not XP.. its 2000.
I have installed SQL server in 3 machines in network includin the one
where i am running the application. now with listavailableservers it
shows the other 2 machines but not the one on where i am working on.|||Is your local database available over the network? Have you enabled a
network protocal using svrnetcn.exe? I noticed the other day that the
documentation says that ListAvailableSQLServers lists 'network-visible
instances' of SQL Server...
I have been suffering a similar (but different) problem. On XP it
appears to decide that if you are not connected to a network then the
server is not 'network-visible' and therefore the (local) server is not
listed. Hmm...
Any suggestions on how to detect if SQLServer is running on the local
machine when it's not connected to a network?
Neil
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
ListAvailableSQLServers not refreshing (VB-Sql server 2000)
by using SQLDMO (ListAvailableSQLServers ) from another pc where
only Sql client is installed
and the list of all servers are avilable.
but when one of the server is down or shut down , the list is not
refreshed and giving error
how to the refresh the server list with out restarting . ping is
another option , but a connection object is
necessary for that.ListAvailableSQLServers consults the local domain browser or master domain
brower for a list of SQL Servers which are registered with it. It may or may
not be current, and it doesn't track active (or running) SQL Servers. You
would need something like ODBC ping for that. ping does not require a
connection object, but if you are trying to make a connection with SQL
Server, you will need a connection object (the connect method of
SQLDMO.SQLServer)
--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
<areejan2000@.yahoo.com> wrote in message
news:1159790536.490769.143470@.m7g2000cwm.googlegroups.com...
>i have 3 Sql server2000 servers running on a network
> by using SQLDMO (ListAvailableSQLServers ) from another pc where
> only Sql client is installed
>
> and the list of all servers are avilable.
> but when one of the server is down or shut down , the list is not
> refreshed and giving error
> how to the refresh the server list with out restarting . ping is
> another option , but a connection object is
> necessary for that.
>
ListAvailableSQLServers not refreshing (VB-Sql server 2000)
by using SQLDMO (ListAvailableSQLServers ) from another pc where
only Sql client is installed
and the list of all servers are avilable.
but when one of the server is down or shut down , the list is not
refreshed and giving error
how to the refresh the server list with out restarting . ping is
another option , but a connection object is
necessary for that.
ListAvailableSQLServers consults the local domain browser or master domain
brower for a list of SQL Servers which are registered with it. It may or may
not be current, and it doesn't track active (or running) SQL Servers. You
would need something like ODBC ping for that. ping does not require a
connection object, but if you are trying to make a connection with SQL
Server, you will need a connection object (the connect method of
SQLDMO.SQLServer)
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
<areejan2000@.yahoo.com> wrote in message
news:1159790536.490769.143470@.m7g2000cwm.googlegro ups.com...
>i have 3 Sql server2000 servers running on a network
> by using SQLDMO (ListAvailableSQLServers ) from another pc where
> only Sql client is installed
>
> and the list of all servers are avilable.
> but when one of the server is down or shut down , the list is not
> refreshed and giving error
> how to the refresh the server list with out restarting . ping is
> another option , but a connection object is
> necessary for that.
>
ListAvailableSQLServers not refreshing (VB-Sql server 2000)
by using SQLDMO (ListAvailableSQLServers ) from another pc where
only Sql client is installed
and the list of all servers are avilable.
but when one of the server is down or shut down , the list is not
refreshed and giving error
how to the refresh the server list with out restarting . ping is
another option , but a connection object is
necessary for that.ListAvailableSQLServers consults the local domain browser or master domain
brower for a list of SQL Servers which are registered with it. It may or may
not be current, and it doesn't track active (or running) SQL Servers. You
would need something like ODBC ping for that. ping does not require a
connection object, but if you are trying to make a connection with SQL
Server, you will need a connection object (the connect method of
SQLDMO.SQLServer)
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
<areejan2000@.yahoo.com> wrote in message
news:1159790536.490769.143470@.m7g2000cwm.googlegroups.com...
>i have 3 Sql server2000 servers running on a network
> by using SQLDMO (ListAvailableSQLServers ) from another pc where
> only Sql client is installed
>
> and the list of all servers are avilable.
> but when one of the server is down or shut down , the list is not
> refreshed and giving error
> how to the refresh the server list with out restarting . ping is
> another option , but a connection object is
> necessary for that.
>
ListAvailableSQLServers does not show local instances
I am using SQL DMO method ListAvailableSQLServers to get the list of all the SQL server available to the local machine.
For some reason, I get all the servers except the instances installed in the local machine. - The are all started.
Any help?
thanks.
I have seen some issues with latency (some servers may not respond fast enough). Also the server instance may be marked hidden.
Start SQL Computer Manager, right click on the Protocols node of the instance and select Properties. Then see if HideInstance is set to No (if not switch to "No" and restart server).
Also try SQLCMD -L
If you see your local instance then it may be a bug in DMO.
|||Thanks Michiel.I forgot to say that I am working with SQL 2000. I can't find the SQL Computer Manager. Also i try isql -L and I get only the default instance in my machine and nothing else, i.e., not the other instance and not any of the network SQL servers.
In the SQL Server Service Manager I can see all the available servers.
any help ?|||you can use the registry for search local instances
Example:
//Registry for local
RegistryKey rk = Registry.LocalMachine.OpenSubKey(@."SOFTWARE\Microsoft\Microsoft SQL Server");
String[] instances = (String[])rk.GetValue("InstalledInstances");
if (instances.Length > 0)
{
foreach (String element in instances)
{
String name = "";
//only add if it doesn't exist
if (element == "MSSQLSERVER")
name = System.Environment.MachineName;
else
name = System.Environment.MachineName + @."\" + element;
if (cmbServers.FindStringExact(name) == -1)
cmbServers.Items.Add(name);
}
the complete Code (smo) can you find at http://www.sqldbatips.com/showarticle.asp?ID=45
it works with dmo too
ListAvailableSQLServers (SQLDMO) not up to date
MSSQL2k+SP3a+MDAC2.8
If I use ListAvailableSQLServers (SQLDMO)
I get after 2 or 3 seconds a Serverlist.
But the serverlist is not up to date.
Thats means a server which shut down 20 seconds before
apperas in the serverlist. A server which started 20 seconds before
dont show in the list.
Thanks ThomasHi
As far as I can tell, the list is cached for a short time to help with
network performance. You will have to experiment to find the exact
timeframe.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Thomas Hase" <tohas@.freenet.de> wrote in message
news:42302c73.366146156@.news.t-online.de...
> Hi NG,
> MSSQL2k+SP3a+MDAC2.8
> If I use ListAvailableSQLServers (SQLDMO)
> I get after 2 or 3 seconds a Serverlist.
> But the serverlist is not up to date.
> Thats means a server which shut down 20 seconds before
> apperas in the serverlist. A server which started 20 seconds before
> dont show in the list.
> Thanks Thomas
ListAvailableSQLServers
Any thoughts how to get around this? Aliasing does not work...
Thanks in advance.Plz first make sure the SQL service is running by checking it under the Services group in the Management console and what startup service account it's using; can u connect to that instance thru Query Analyzer? If yes then type in
select serverproperty('servername').
Check the mode of Authentication u r tryin to connect to SQL thru. Post some details about the startup-service account etc.
Howdy.|||Since the (local) server is nearly "hardwired" into the list, there isn't a good way to avoid it. The machine name should still appear in the list anyway. I usually just put in code to ignore both the IP address and the constant (local) as I iterate through the list of servers.
-PatP|||Sorry, SPE (Stupid Programmer Error); one of my ADO connection strings had the data source hardcoded (leftover from testing). Thanks both...|||Hmmm... We know those as ID10T errors. Same difference!
Glad you are working now!
-PatP