I have a remote database that will be accessed through a client program.
The thing is, I want the client to auto detect the IP Address of the machine
where the database is located, so that when I initialize the value of my
connection string it would be like this:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\AutoDetectedIpAddress\folder\myDatabase.mdb;User Id=admin;Password=;

In that way, the client program will automatically connect to the
remote database whatever the IP Address of the machine where the
remote database is. I don't have any clue to do this so, I'm
asking for your help guys.

Thanks in advance!

Edited by ryklon: n/a

5 Years
Discussion Span
Last Post by Alosh

I suggest you reconsider connecting via the IP address. Let the infrastructure take care of name/address translation for you and just connect using the server name. Using the IP address could impact database access in a system where clustering/mirroring provides high availability.

Votes + Comments
Thanks for the tip!

Thanks for the reply!

Ok. I'll take your advice. But is there any chance that I can do some kind of auto detect feature? If there is none, then I'd be fine with manually doing the connection.


If this is over LAN or WAN (VPN or leased line), then you can just use the computername. Your DNS or WINS will take care of the name resolution to the IP.

If you plan to connect over the internet then perhaps you've got to search services like dynDNS or something similar (google for free dynamic dns).
Some DSL routers support dynamic dns and you can have a hostname with a dynamic IP with no software.
BUT, be warned the type of access you are looking for in your "server" machine (sharing your actual file) shouldn't be done over the internet without a VPN (and because of this you don't need dynDNS).

Votes + Comments
Thanks for the tip!

Thank you guys for your explanations!

I'll follow what you've suggested.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.