Is there a possibility to enumerate all available sql servers in pure java.
At this time i execute osl -L and interprete the result.
Process p = runTime.exec("osql -L");
Computers without a msde or sql server installed do not have the osql
program. Is there a way to install osql? Or is there an other way to find all
available sql servers?
Thanks in advance Davy
You could simply try to connect to port 1433 of all machines and/or use
a JDBC driver that supports named pipes and try to connect via named
pipe to each machine in the network. This might take quite a while,
though.
Alin.
|||Thanks for the respond.
I already tried to connect to all machines, but i took a while (some minutes
which is too long).
I also tried to open a socket on port 1433, but sql server does not respond.
Is there a possibility to multicast a udp message to all ms-sql-monitors
(port 1434)?
Pipes is maybe an alternitive, but i'm not sure if pipes are enabled.
Davy
|||UDP port 1434 might just work. Give it a try and let me know how it
goes.
Alin.
|||Davy:
Rolling your own sqlbrowse with UDP on port 1434 should work, but if
you're considering going through OSQL then you'd be better off using
ODBC (SQLBrowseConnect) which is on every Windows box.
Be careful that this broadcast method is pretty imprecise -- Windows
machines after XPSP2 (esp. W2K3+) turn off port 1434 by default, and the
SQL Server 2005 will also ship with this port off by default for most
scenarios.
-shelby
Shelby Goerlitz
Microsoft SQL Server
"Davy" <Davy@.discussions.microsoft.com> wrote in message
news:Davy@.discussions.microsoft.com:
> Thanks for the respond.
> I already tried to connect to all machines, but i took a while (some
> minutes
> which is too long).
> I also tried to open a socket on port 1433, but sql server does not
> respond.
> Is there a possibility to multicast a udp message to all ms-sql-monitors
> (port 1434)?
> Pipes is maybe an alternitive, but i'm not sure if pipes are enabled.
> Davy
|||It’s quite difficult to find out the structure of the udp messages send by
the sql monitor. If anyone knows the udp structure all information is
welcome. I can try to write the udp messages with some help.
Davy
"Alin Sinpalean" schreef:
> UDP port 1434 might just work. Give it a try and let me know how it
> goes.
> Alin.
>
|||So it doesn’t seem a good idea?
I'll give it try, if someone has any idea which information to store in the
udp messages.
I tried the SQLBrowseConnect method as well. I couldn't call it directly
from java, but I found a C++ program.
http://www.sqldev.net/misc/ListSQLSvr.htm
It's easy to use from java and it uses the SQLBrowseConnect API, which is
osql independent.
Thank you very much
Davy
|||> I'll give it try, if someone has any idea which information to store
in the
> udp messages.
Just send a single 0x02 byte. You can find more info about the response
here [jTDS source code]:
http://cvs.sourceforge.net/viewcvs.p...=1.7&view=auto
Alin.
|||So, it's not even that difficult. I'm working on it, i hope to finish it
tomorrow. I'll post the result. Maybe one more question: any idea how to find
out the multicast address?
Right now i'm testing with a fixed 10.0.0.255 multicast address. Probably
this address want be te same for every company, but how can i calculate this
address?
Davy
"Alin Sinpalean" schreef:
> in the
> Just send a single 0x02 byte. You can find more info about the response
> here [jTDS source code]:
> http://cvs.sourceforge.net/viewcvs.p...=1.7&view=auto
> Alin.
>
|||Ok, i created some classes to look up all sql servers reachable by a
computer. The program performs a lookup of all subnets of a computer and send
the 02 multicast message on each subnet.
Where should i put the classes? Here as plain text on the forum?
To lookup the subnet of an ip, I use IPCONFIG. Ipconfig is translated, so I
included english, french and dutch. If you need more languages you should add
the texts. I'll add some comment to the source code.
Davy
"Alin Sinpalean" wrote:
> in the
> Just send a single 0x02 byte. You can find more info about the response
> here [jTDS source code]:
> http://cvs.sourceforge.net/viewcvs.p...=1.7&view=auto
> Alin.
>
sql
No comments:
Post a Comment