This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

List all available sql server running on my lan/network

 
Rituraj Jain
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • 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
    • 0
    • Mark post as helpful
    • send pies
    • 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
    Eclipse IDE Hibernate Java
    • 0
    • Mark post as helpful
    • send pies
    • 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
    • 0
    • Mark post as helpful
    • send pies
    • 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
     
    I agree. Here's the link: http://aspose.com/file-tools
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic