aspose file tools*
The moose likes JDBC and the fly likes Enumerating SQL Server instances Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Enumerating SQL Server instances" Watch "Enumerating SQL Server instances" New topic
Author

Enumerating SQL Server instances

jay akhawri
Ranch Hand

Joined: Nov 28, 2004
Posts: 47
Hi All,

I am trying to build an application which can enumerate MS SQL Servers in a LAN. There are few approaches in ODBC, and .Net which lets you do it. Such as SQLBrowseConnect (an ODBC API) and SMO, DMO etc.

however, i want to build such functionality without extensively spending my time through JNI --> ODBC/SMO(.Net)/DMO(COM) approach.

What could be other approaches?
Are there any impementation?

Regards,

~ Jay

Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

I don't think this is possible without an MS API. Finding default instances could be done by brute force I suppose, but I don't know how you would go about finding named instances. The easiest approach (if you want to involve Java) is to call sqlcmd -L via ProcessBuilder and parse the output.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Enumerating SQL Server instances