Sql-server – Can an application connect to databases from on-premise SQL Server Instance and Azure SQL together

azure-sql-databasesql server

Can a single application connect to two different databases each of which is in different Instances. One instance has on-premise deployment, the other one is Azure SQL(not SQL in Azure VM). So basically is it possible for an application to access data from both Instances?

Best Answer

Yes, you can use so many connections you need.

For instance, if you're programming for .Net framework simply instantiate two or more SqlConnection class and set up the ConnectionString property according the DB you are trying to access.

You can find some examples about ConnectionString's here.

And MS Docs about Azure ConnectionString's here.