How to Access Database hosted on localhost sql server 2008r2 by another computer in LAN

StackOverflow https://stackoverflow.com/questions/22173406

  •  03-06-2023
  •  | 
  •  

Question

I created a windows form application in which I used an SQL server database.

It is working fine on my computer. Now I want to run this application on another computer that is connected with LAN with my computer.

The problem is both application must share the same database. I don't want to host my database online.

Please tell me how to access the same database from different computers by using LAN or another technique.

Was it helpful?

Solution

You will have to set up the SQL server to allow access from within the LAN.

You may also have to set up the firewall on your server to allow access to the SQL server port(s), usually 1433 1434 for MS SQL server.

Then point your application on the client machines to the server's IP address within your lan. Usually something like 192.168.xxx.xxx

OTHER TIPS

Find the folder where your DB files are. SHARE that folder to 'Everyone' in network.
Turn*Off* Windows Firewall (this can be a problem sometimes when it's turned on).

Be sure that your second PC has the same ConnectionString (ServerName, ex. //PC-NAME/SQLEXPRESS) and is watching into your 'server' computer (PC with database on it).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top