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.
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:
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.
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.
Joined: Nov 28, 2008
thanks for suggestion. i think using of ProcessBuilder is a better way as you said, so i am going to use that way.