Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to connect to local database via website?

Tags:

c#

sql

asp.net

I have a website used by clients for reporting purposes and would like to give clients the option of my website reading their local database directly (instead of them providing data in a file format). In most instances their database would be SQL Express setup on their localhost.

How can I connect to a clients local SQL server via my website, using asp.net / javascript etc? If the client provides their connection string properties, localhost would just refer to my server's localhost...

Consider the following :

Most people connect to the internet via an ISP. THeir database will run on their localhost and will not have a public address as such.

Ideally, the client must supply some connectionstring (database name, login etc.) and my server must connect.

VPN's wont work for this - I must connect to them (in a programmatic way) and pull data, not the other way around.

Thanks

like image 852
Carlo Avatar asked Nov 05 '22 04:11

Carlo


1 Answers

Providing your clients firewall has been configured to allow connection to SQL Server (the default port is 1433), there's nothing stopping you creating a connection to it. There are security considerations to doing this, however. your client may wish to only allow connection from your web-servers IP Address.

You might also consider a VPN such as the VPN provided by Windows or Hamachi.

like image 106
Moo-Juice Avatar answered Nov 11 '22 04:11

Moo-Juice