This article helps you connect your externally hosted database and assumes that you have already prepared your database to make it usable. More information on how to prepare your database is available on the Preparing your hosted database for Relational Data page.
Prerequisites
For Emarsys to successfully access your database, it needs to be configured as follows:
- Grant the following permissions to the Emarsys user:
DELETE
INSERT
SELECT
UPDATE
VIEW DEFINITION
SHOWPLAN
Add the following IP addresses to the relevant allowlist: 34.89.173.3
, 34.89.137.140
, 35.246.249.205
, 185.4.123.112
This connector is only designed for Microsoft hosted Azure SQL databases on the .database.windows.net
domain which uses the standard port 1433
if you are hosting your own Azure server then you should use the MS SQL connector instead.
Please note that Azure Synapse connections are not supported.
Setting up the connection
The first step in using Relational Data is to set up the connection between your database and Emarsys.
- In the Emarsys platform, go to Add-ons > Relational Data > Connections.
In your Azure SQL database, the following roles should be assigned to the Emarsys user:
- In the top right corner in Connections, click Create New Connection.
- Select Azure SQL.
- Configure your connection as follows:
- Connection Name: the reference you want to give to your connection, can be the same as the DB name.
The Connection name can include only upper-, and lowercase English letters, numbers and underscores. It must start with a letter or an underscore.
- Host: the host name of the database
- User name: the login name of the user you want to use for this connection
- Password: the password of the user you want to use for this connection
- Connection parameters (optional): specify additional Java DataBase Connectivity (JDBC) version 2.1 connection parameters you would like to use when establishing the connection, or leave empty to use the default parameters.
- When you finished adding all the necessary data, Test your connection.
- Click Save to create the connector you just set up.
You are done and can now either:
Specifying the default schema in your Azure SQL database
Azure databases do not support JDBC parameters to specify the default schema.
Azure databases store the default schema on the user's table.
List tables and schemas with the following query:
SELECT table_schema, table_name
FROM information_schema.tables
You can show the default schema for a specific user with this query:
SELECT default_schema_name
FROM sys.database_principals
WHERE name = 'YourUserName';