I want to create server in one system and make another system as clients like if i save data in server that is also saved in clients system .So what datasource i have to give i mean to say that if i run setup in any system then that database is detected automatically i do not need to give its location.

Are you running on SQL Server?

Ans :No I have access database and i want that : this databse is accessed by three system that are connected in Lan means in server i stord the database and through clients i access that database

Put it in shared location on lan and access it. But the question is Access able to handle more than one user concurrently? the answer is no.

Ramy has it right that Access is not a "real" database in the sense you can't have multiple users simultaniously.

Since this a VB.NET (programming) forum, I guess you're building the system at the moment. I suggest taking a look at some other data storage. Like SQL Server or MySQL. If the money is an issue, take a look at SQL Server Express and MySQL Community Edition. And there are few other DB options too.

These guys are right... Access will work on a very, very limited basis, but doesn't really qualify as a true database solution. We use MySQL for our projects, and it performs very well, plus it has the bonus of being free.

There is a second aspect to your question, and that is the auto-discovery. You mentioned you want clients to automatically discover the server without being told where to find it. Someone correct me if I'm wrong, but I'm not aware of a way to do that with MySQL or MSSQL.

In order to achieve that, you're probably going to have to write your own autodiscovery tool. This would most likely take the form of a small program running on your server, listening for broadcasts on a particular port, containing a particular bit of data to identify a requesting client. On the client, you'd want a bit of code to run at the beginning of execution that sends out a broadcast on your network and listens for a reply. When the server receives a broadcast asking for service, it would send back its IP address. The client could then use the IP address to connect to the SQL server. It would look something like this:

Client  --- Is there a server out there? --->  Network Broadcast
Server hears network broadcast and gets requesting IP.
Server --- Yes, Here's my IP ---> Requesting Client IP
Client --- Connect to SQL Database ---> Server IP

You'll need to read up a bit on how to create network clients and servers, listeners, and other networking topics, if you're not already aware of how to do it. But the above is the general outline of what would need to happen. After that, your client could just connect to the database using ODBC, like normal.

Good luck!

Pirate, in business application development, we can't rely on auto discovery tool there's something called connection string, which holds database server IP\name, user credentials, some other properties, etc..; may be encrypted or may be not. and you configure it at clients' place.
And you said ODBC. and this is correct.

Ramy and Pirate are right that the server i.e. DB's location should be known before. When the client application is installed, the credentials and correct connection string is formed and saved to client's configuration settings.

This may go a bit OT from what the OP asked, but SQL Server has SQLDMO (COM component) which can be used to enumerate server instances from the LAN. Once the server instances are known, databases can be enumerated with SQLDMO. MySQL may have something similar (and probably has) but I'm not totally sure about that.

It has. And he can use SMO, to enumerate every object in the server.
But it's not applicable in business application development except in very critical situations.

Ramy - I was just going off of the OP, which said:

if i run setup in any system then that database is detected automatically i do not need to give its location.

If there's some sort of mechanism built into MSSQL or MySQL that allows enumeration over a LAN without prior knowledge of a server's IP address, than by all means, that's the way to go. The project I'm involved with at the moment actually stresses having the clients NOT know anything about the SQL server. It's a game, and in order to minimize attempts at cheating, we're working on our own custom protocol, so clients will not be using SQL queries at all, just the customer server software.

Teme - I've been working with MySQL for a while, and don't know of any mechanism like SQLDMO. That doesn't however, mean that it doesn't exist, and the fact is that so many people have written so many good extensions to MySQL that it wouldn't be at all surprising if somebody had written one like that. The Pirate project doesn't require any MySQL extensions, so I'm not very well versed in this area.

Oops! Ramy obviously knows there IS a discovery mechanism! Teme, disregard me on that one!

:$

This article has been dead for over six months. Start a new discussion instead.