• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

List all available sql server running on my lan/network

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any one capable of listing all the running sql servers on the lan.

i am on an intranet on each computer (50 out of 70) computers have sql servers installed, now i want to list all the available sql servers in core java. i just want the names of all ther servers. so that i can connect to them as i know user name and pass words of each of them.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no API to do this in Java. There are API in VB and C#, so you will need to first write your program in one of those languages then call this program via the ProcessBuilder.

The libraries MS supply to do this sort of thing are:
  • Microsoft.SqlServer.Management.Smo
  • Microsoft.SqlServer.ConnectionInfo


  • Have a look in MSDN for more info. Be aware that there is a difference between those visible over the LAN and those accessable over the LAN; there may be more out there than your program can see. SQL Server has a broadcast service that announces the existance of an instance (which is what makes stuff appear in the drop down from the Management Studio when you create a connection) which is not required to make a default instance accept connections from remote clients.
     
    Rituraj Jain
    Ranch Hand
    Posts: 37
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    thnx for reply. but i was wondering if i can write a program in java.. anyways thnx for reply
     
    Paul Sturrock
    Bartender
    Posts: 10336
    Hibernate Eclipse IDE Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    No. You could write a Java program that tried to discover SQL Server instances by connecting to every node in your LAN on port 1433 and examining the response. However, you would still need to discover evey node in the LAN and you would not be able to discover the SQL Server instances that are not configured to allow TCP/IP connections (which is the default from version 2005 onwards) unless the SQL Server Browser service is running on that node. Since the browser service is optional, and is a likely candidate to be disabled for security reasons you can't rely on that either.

    Writing this in VB or C# is easy however. Calling a VB or C# program from Java via the ProcessBuilder is also easy. I'd use that route if I were you.
     
    Rituraj Jain
    Ranch Hand
    Posts: 37
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    thanks for suggestion. i think using of ProcessBuilder is a better way as you said, so i am going to use that way.

    Thanks
     
    Don't get me started about those stupid light bulbs.
    reply
      Bookmark Topic Watch Topic
    • New Topic