Amit Hasan
Amit Hasan

Reputation: 1450

How to connect multiple computers to use same Database from a WPF application?

A (WPF) application for a small business used from multiple machines (<5) may use only one database (from SQL Server express). All computers are close enough to connect them with wire. A possible solution for such requirements would be to use a CPU as database source and all other machine could be connected to this CPU. That way every user will essentially be working with same data.

Currently the best solution I can think of is to buy space from an external webserver to keep database and use WebAPI to retrieve and push data to the server. But not all business would agree to use this method for different reasons.

So how do you solve this problem without using an external webserver? I can guess that more hardware and software are involved but I don’t know what those tools are and how to use them. I think this is a common scenario and the solution should be low cost so that small businesses can afford it.

Not sure if it is off topic or on topic but it is probably something to worry about for many beginners like me.

Upvotes: 1

Views: 3952

Answers (1)

Maximus
Maximus

Reputation: 3448

If external server is prohibited then other way out is to devote one computer and host there both database and service(WCF for instance). Service will be dealing with database and clients in turn with service. By depriving client of direct access to database you make sure that it will not jeopardize security. Within service you can take care about aspects such as transaction, concurrent invocations, authentication etc. Every client communicates with specific address, that is instead of localhost for instance 128.169.1.2. This address refers to computer where service along with database are hosted. Having service is inevitable since clients may be accessing database simultaneously and as a result data could be overwritten.
EDIT
If your computers reside at the same local group (for instance LAN) then you can effortlessly comminucate to each other. I refer you to this post to take a look how easy it is, just basic WCF service with precise address specified.

Upvotes: 3

Related Questions