|
-
Sep 24th, 2006, 08:11 AM
#1
Thread Starter
Frenzied Member
finding sql servers on the network.
Hello,
I am creating a application that can connect any sql server on the network.
The customer would like a dialog box to be able to find a instance of a server, and then enter the password and username to get a list of all the database they want to connect to.
Does anyone have any examples projects in vb.net that does something like this.
I will be most grateful for any code.
Thanks in advance,
Steve
-
Sep 24th, 2006, 05:05 PM
#2
Banned
Re: finding sql servers on the network.
Actually finding general SQL servers on the network could prove troublesome. The idea you begin with when considering an SQL server is that you know exactly where it is at.
You'd probably have to adopt a portscanner-type technique. However, this would be limited to the specific local IP range that you set (example: your app sees that an adapter has a local IP of 192.168.0.5, so it checks IPs 192.168.0.1-254). The main problem you are still faced with in this situation is that the SQL server must be running on a pre-defined port, or a small set of pre-defined ports.
A full network scan may work, but it will be important that any internal security mechanisms do not stop it, and the servers must all be in one general IP range to be found, hopefully avoiding weird gateway hops into other ranges.
I hope this helps out a bit. I primarily deal with SQL in Java, but I would be interested in taking this project up if you'd like. You can see http://www.vbforums.com/showthread.php?t=429437 in that case. (admins: I know I'm blatantly advertising here, so please let me know if this sort of thing is unacceptable )
-
Sep 26th, 2006, 10:41 AM
#3
Frenzied Member
Re: finding sql servers on the network.
You may want to have a look at http://pinvoke.net/default.aspx/netapi32.netserverenum
You can call NetServerEnum and pass SV_TYPE_SQLSERVER as a flag.
The code is in C# but shouldn't be too hard in VB.NET.
If you're on the .net framework v 2.0 be sure and use a List<T> instead of the ArrayList used in the sample code for a performance boost.
-
Sep 26th, 2006, 11:21 AM
#4
Re: finding sql servers on the network.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|