I have a desktop application running on a few PCs on a local network, the application is connected to a Microsoft SQL Server database installed on a server.
This server is connected to the internet, while the PCs are not.
My question here, is that I want to migrate my database to Azure SQL database, but since my PCs do not have a direct access to the internet and VPN is not an option, is there a way where I can make my server to work as an intermediary (client-server) between my application running on local PCs (LAN) and my Azure database online?
Thanks
1条答案
按热度按时间uxh89sit1#
Actually there is a solution for this... First you link the Azure SQL DB server to the on-prem one, sp_addlinkedserver or follow this guide: How to create Linked server from SQL Server to Azure SQL Database
Once the server link is established, you can use a 4 part name system to query tables in the linked server:
Example
If your intent is to migrate the data without making any changes to the source code, so not re-writing any queries, then you might be interested in CREATE EXTERNAL TABLE
External table replicates the schema for specific tables (but none of the data) so with this and an empty database you can effectively provide remote access to the external databases.
If I create External tables for
SensorInstance
andReadings
for the above example then the query looks like this:You could also host an API on the server that executes the SQL calls for you. This however requires modification to your application and for you to design the API. If you do this,
If your PCs have access to the server, and the server has access to the internet, then VPN is a viable solution, you use the server as a gateway and should be able to VPN tunnel through that gateway...