Hi All, Using TCP method , is it possible to find all the SQL instances running on a machine? Thanks in advance. Supriya.
Not sure what you meant by 'TCP method'. If you just scan the ports, it is not reliable and practical. I found it's most reliable to identify the SQL Server services by inspecting the registry. That of course requires access to the registry.. Linchi "Supriya" wrote: > Hi All, > Using TCP method , is it possible to find all the SQL instances running > on a machine? > Thanks in advance. > Supriya. > > >
It's easy to discover what SQL Servers are on the net--even when they aren't running. The following is a segment of code from an example I use in my workshops and session talks (it's from my book). It should get you started. Private Sub ReturnListOfServerInstances(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim drProvider As DataRow = DbProviderFactories.GetFactoryClasses.Rows(0) ' To make sure object is instantiated Try Me.Cursor = Cursors.WaitCursor ' DbProviderFactories is a new class for ADO 2.0 ' GetFactoryClasses is a new method for ADO 2.0 tblProviders = DbProviderFactories.GetFactoryClasses() For Each drProvider In tblProviders.Rows Dim factory As DbProviderFactory = DbProviderFactories.GetFactory(drProvider) Dim dsE As DbDataSourceEnumerator = factory.CreateDataSourceEnumerator() If dsE Is Nothing Then Else DataGridView1.DataSource = dsE.GetDataSources() End If Next drProvider Catch exCE As System.Configuration.ConfigurationException MsgBox("The " & drProvider(0).ToString & " could not be loaded.") Catch ex As Exception MsgBox(ex.ToString) Finally Me.Cursor = Cursors.Default End Try End Sub "Linchi Shea" wrote in message news:9A049AA4-2C97-484D-AA70-45D8B7F53372@microsoft.com... > Not sure what you meant by 'TCP method'. If you just scan the ports, it is > not reliable and practical. I found it's most reliable to identify the SQL > Server services by inspecting the registry. That of course requires > access > to the registry.. > > Linchi > > "Supriya" wrote: > >> Hi All, >> Using TCP method , is it possible to find all the SQL instances >> running >> on a machine? >> Thanks in advance. >> Supriya. >> >> >> -- __________________________________________________________________________ William R. Vaughn President and Founder Beta V Corporation Author, Mentor, Dad, Grandpa Microsoft MVP (425) 556-9205 (Pacific time) Hitchhikerâs Guide to Visual Studio and SQL Server (7th Edition) ____________________________________________________________________________________________