File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Enumerating SQL Server instances Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Enumerating SQL Server instances" Watch "Enumerating SQL Server instances" New topic

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?


~ Jay

Paul Sturrock

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
I agree. Here's the link:
subject: Enumerating SQL Server instances
It's not a secret anymore!