In this blog we will explore how to access an Azure SQL Database table from SAP HANA Cloud.
- You have access to Microsoft Azure portal
- An Azure SQL Database
- Access to Microsoft SQL Server Management Studio
- Access to SAP HANA Cloud instance
- DP Agent with MssqlLogReaderAdapter enabled
We will start with Azure side of things. So let’s login to the Microsoft Azure portal and navigate to the Azure SQL Database. Towards the right of overview, click on set server firewall
We need to add the following hosts into the firewall so that they can access the Azure SQL Database
- Client Machine used to login to Azure portal
- DP Agent Host
- SQL Server Management Studio Host
Login to the host which has Microsoft SQL Management Studio and create a connection to the Azure SQL database. You can get the Server name from the overview section (screen shot 1)
Once connected to the Azure SQL Database, navigate to master database and run the below SQL
CREATE LOGIN DP_USER with password = 'Welcome01' go
This SQL command will create a login for DP Agent to login to the Azure SQL database
Connect to user database SQLDB_HSC_DE and run the SQL to create a user for login DP_USER
Create user DP_USER for login DP_USER
Now, we will make the user DP_USER as the db owner using the following SQL command.
EXEC sp_addrolemember ‘db_owner’,’DP_USER’
Log on to Azure SQL Database as user DP_USER and enable Direct Administration Connection DAC using the following commands.
sp_configure ‘remote admin connections’, 1 go reconfigure go sp_configure ‘remote admin connections’ go
Let us look at the table in Azure SQL Database that we want to access from SAP HANA Cloud. It is the Address table
Login to SAP HANA Cloud and open the database explorer . Then navigate to Remote Sources under Catalog
Right click and add a new remote source named AZURE_SQL. We will need to provide the DP Agent location , Azure SQL Database IP and credentials to create the remote source as depicted in the below screenshot.
Once the remote source is created, it will display the objects in the Azure SQL database.
Choose the Address table and create a virtual object in SAP HANA Cloud.
Once the table is created, it will be visible under Tables in the SAP HANA Cloud catalog.
Click on open data to view the data in the Address table
SAP HANA Cloud provides users with options to access data residing in cloud databases like Azure SQL Database quite easily with simple configuration steps. This allows users to see data from various different data sources in a single pane.