UNIX: Create Region and Cross-Region Data Sources for Azure

Note: We recommend that you use a connection string to connect to Azure databases; that is, using the connect attribute within the database configuration file, which is covered in Update the Configuration File for Azure Region and Cross-Region Databases.

If you did not use connection strings, use the following steps to create ODBC data sources to access the region and cross-region databases.

There are a number of different driver managers that you can use to configure an ODBC data source. These instructions are carried out using unixODBC. If you are using a different driver manager, consult the vendor instructions for creating data sources.

  1. Run the command odbcinst -j command, and note down the location of the drivers configuration file (odbcinst.ini) and the user data sources configuration file (.odbc.ini).
  2. Open the odbcinst.ini configuration file and ensure that you have something similar to the following:

    (This may differ depending on the version of Azure you are running.)

    [ODBC Driver 17 for SQL Server]
    Description=Microsoft ODBC Driver 17 for SQL Server
    Driver=/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.2.so.0.1
    UsageCount=1
  3. Open the .odbc.ini configuration file and add an entry for the mandatory data source:
    [<datasource-name>]
    Driver = <driver-name>
    Server = <server-name>
    Database = master
    where:
    • <datasource-name> - a name for the data source.
    • <driver-name> - the name of the driver as configured in the .odbcinst.ini file; in the example above, that would be ODBC Driver 17 for SQL Server.
    • <server-name> - the name of the server on which the database instance resides.
    • master - the name of the primary configuration database supplied with Azure.
  4. Add a new data source for a region database:
    [<datasource-name>]
    Driver = <driver-name>
    Server = <server-name>
    Database = <region-name>
    where:
    • <region-name> - the name of the enterprise server region that this database will serve.
  5. Add a new data source for a cross-region database:
    [<datasource-name>]
    Driver = <driver-name>
    Server = <server-name>
    Database = _$XREGN$
  6. Save the .odbc.ini configuration file.

Example .odbc.ini file

The following is an example of an .odbc.ini configuration file that contains data sources for an Azure database instance that stores files from the ESDEMO enterprise server region in a region and cross-region database.

[AZ.MASTER]
Driver = ODBC Driver 17 for SQL Server
Server = localhost
Database = master

[AZ.CAS.ESDEMO]
Driver = ODBC Driver 17 for SQL Server
Server = localhost
Database = ESDEMO

[AZ.CAS.CROSSREGION]
Driver = ODBC Driver 17 for SQL Server
Server = localhost
Database = _$XREGN$
The data sources for the region and cross-region databases are configured. You can now configure your enterprise server regions to use the databases.