Skip to main content

Connect to SAP HANA from ArcGIS

To publish ArcGIS Server web services that reference the data in an SAP HANA database, install and configure the SAP HANA client ODBC driver on all the machines in the ArcGIS Server site.

Note:

SAP HANA clients are available to existing SAP users from the SAP Support Portal under Software Downloads.

After the ODBC driver is configured on all ArcGIS client machines, create a database connection file and register the database connection file with your ArcGIS Server sites.

Install and configure the SAP HANA client

Download a supported 64-bit SAP HANA client from the SAP Support Portal under Software Downloads, and install it on all ArcGIS Pro machines and machines in ArcGIS Server sites with which you will register a connection to an SAP HANA database.

Follow instructions provided by SAP HANA to install and configure the ODBC client.

Install the SAP HANA on the ArcGIS Server machines

Download the SAP HANA client ODBC driver. Place the client on each machine in the ArcGIS Server site, install it, and edit the ArcGIS Server init_user_param.sh script on each ArcGIS Server Linux machine.

  1. Download a supported 64-bit SAP HANA client from the SAP Support Portal, and install it on each machine in the ArcGIS Server site.

  2. Install a Linux ODBC driver manager on each ArcGIS Server machine if one is not already installed.

    After you install the database client files, alter the init_user_param.sh script installed with ArcGIS Server to reference the client files. You can access this script by browsing to the <ArcGIS Server installation directory>/arcgis/server/usr directory.

    You must update the init_user_param.sh on every machine in the ArcGIS Server site.

  3. Ensure that the ArcGIS Server installation owner on each machine has at least read and execute permissions on the database client libraries.

  4. Open the init_user_param.sh script in a text editor.

  5. Remove the comment mark (#) from the lines that begin with export and replace the <SAPHANA_InstallDir> information with the path to the directory where you installed the SAP HANA client:

    # -----------------------------------------------------------------------
    # Modify this section to configure a connection to SAP HANA.
    #
    # To make a connection, name the SAP HANA ODBC configuration files as .odbcinst.ini
    # and .odbc.ini and store them in the ArcGIS Server user $HOME directory.
    #
    # -----------------------------------------------------------------------
    export SAPHANADIR=<SAPHANA_InstallDir>/sap/hdbclient
    export LD_LIBRARY_PATH=$SAPHANADIR:$LD_LIBRARY_PATH
    
  6. Save and close the script.

  7. For the changes you made in the init_user_param.sh file to take effect, you must restart ArcGIS Server.

    To do this, run the stopserver.sh script, then run the startserver.sh script on each machine in the ArcGIS Server site.

    ./stopserver.sh

    ./startserver.sh

Once you have the SAP HANA client ODBC driver installed, you can create a database connection and register it with your ArcGIS Server site. If the following conditions exist, however, you must configure a data source name for the ODBC driver before you create and register a database connection:

  • You're using SAP HANA 1.0 (any supported service pack release).

  • You're connecting to SAP HANA Cloud.

  • You're connecting to the database from ArcGIS Server 10.6 or earlier.

  • The number of characters in the SAP HANA server name and SQL port number of your SAP HANA server exceeds 31.

Configure an ODBC data source name on Linux (if required)

If you require a data source name, follow these steps to configure a system data source name for the SAP HANA client ODBC driver on each ArcGIS Server Linux machine:

Note:

Use the same ODBC data source name when configuring all SAP HANA ODBC clients to that same database. For example, configure the data source name on your ArcGIS Pro machines to be the same as the data source name for the SAP HANA client ODBC driver on the machines in your ArcGIS Server sites. If you do not use the same name, you will encounter problems when publishing, because ArcGIS compares the connection strings of the data being published and the database that is registered.

  1. To configure an ODBC data source name, edit the SAP HANA ODBC connection files, .odbc.ini and .odbcinst.ini.

    The files must be named .odbc.ini and .odbcinst.ini.

  2. Open the .odbc.ini file in a text editor and provide the information necessary to connect to your database.

    Ensure there are no spaces around the equal signs (=) in the .odbc.ini file.

    For example, this entry does not have spaces around the equal signs. The SPATIALTYPES=1 entry is included. This entry is not required to connect to supported versions of SAP HANA 2.0 or later.

    [<HANA_DNS>]
    Driver=/<usr>/sap/hdbclient/libodbcHDB.so
    Description=SAP Hana ODBC
    ServerNode=<HANA_Server_IP>:<SAP_HANA_port>
    UID=<user_name>
    Password=<user_password>
    SPATIALTYPES=1
    
    [ODBC]
    IANAAppCodePage=4
    InstallDir=/<usr>/sap/hdbclient
    Trace=0
    TraceDll=/opt/odbc64v51/lib/odbctrac.so
    TraceFile=/tmp/odbctrace.out
    UseCursorLib=0
    
  3. To connect to SAP HANA Cloud, use an encrypted connection, which requires that every machine in the ArcGIS Server site be able to reference the DigiCertGlobalRootCA.crt.pem file to verify the Certificate Authority (CA) that signs the SAP HANA Cloud certificate. Download this file from the SAP Help portal and place it in a directory on each of the machines in the site. Set Encrypt=Yes and set the sslTrustStore parameter to one of the following:

    • Specify the location of the DigiCertGlobalRootCA.crt.pem file on the local machine as shown in the following entry:

      [<HANA_DNS>]
      Driver=/<usr>/sap/hdbclient/libodbcHDB.so
      Description=SAP Hana ODBC
      ServerNode=<HANA_Server_IP>:<SAP_HANA_port>
      UID=<user_name>
      Password=<user_password>
      ENCRYPT=Yes
      sslTrustStore=<path to DigiCertGlobalRootCA.crt.pem>
      
      [ODBC]
      IANAAppCodePage=4
      InstallDir=/<usr>/sap/hdbclient
      Trace=0
      TraceDll=/opt/odbc64v51/lib/odbctrac.so
      TraceFile=/tmp/odbctrace.out
      UseCursorLib=0
      
    • Provide the certificate string from the DigiCertGlobalRootCA.crt.pem file. Open the DigiCertGlobalRootCA.crt.pem file, copy the contents, and paste it between the BEGIN CERTIFCATE and END CERTIFCATE notation in the .odbc.ini file as shown below:

      [<HANA_DNS>]
      Driver=/<usr>/sap/hdbclient/libodbcHDB.so
      Description=SAP Hana ODBC
      ServerNode=<HANA_Server_IP>:<SAP_HANA_port>
      UID=<user_name>
      Password=<user_password>
      ENCRYPT=Yes
      sslTrustStore=-----BEGIN CERTIFICATE-----<contents of the DigiCertGlobalRootCA.crt.pem file>-----END CERTIFICATE-----
      
      [ODBC]
      IANAAppCodePage=4
      InstallDir=/<usr>/sap/hdbclient
      Trace=0
      TraceDll=/opt/odbc64v51/lib/odbctrac.so
      TraceFile=/tmp/odbctrace.out
      UseCursorLib=0
      
  4. Save and close the .odbc.ini file.

  5. Open the .odbcinst.ini file and edit it to include the ODBC driver path.

    In the .odbcinst.ini file, the same sort of spacing is not required, as shown in this example:

    Description  =SAP HANA ODBC
    Driver64         = /<usr>/sap/hdbclient/libodbcHDB.so
    
  6. Save and close the .odbcinst.ini file.

Install the SAP HANA on the ArcGIS Server machines

Download the SAP HANA client ODBC driver and install it on each machine in the ArcGIS Server site.

Install the SAP HANA client ODBC driver on each ArcGIS Server Windows machine:

  1. Download a supported 64-bit SAP HANA client from the SAP Support Portal, and install it on each machine in the ArcGIS Server site.

  2. Add the SAP HANA client installation directory to the Windows system PATH environment variable.

    For example, if you installed the SAP HANA client ODBC driver to C:\Program Files\sap\hdbclient, add that to the PATH environment variable.

Once you have the SAP HANA client ODBC driver installed, you can proceed with registering a database connection with your ArcGIS Server site. If the following conditions exist, however, you must configure a data source name for the ODBC driver before you register a database connection:

  • You're using SAP HANA 1.0 (any supported service pack release).

  • You're connecting to a SAP HANA Cloud.

  • You're connecting to the database from ArcGIS Server 10.6 or earlier.

  • The number of characters in the SAP HANA server name and SQL port number of your SAP HANA server exceeds 31.

Configure an ODBC data source name on Windows (if required)

If you require a data source name, follow these steps to configure a system data source name (DSN) for the SAP HANA client ODBC driver on each ArcGIS Server Windows machine:

Note:

Use the data source name when you connect from ArcGIS to the database. Use the same name when configuring all SAP HANA ODBC clients to that same database. For example, use the same data source name when you configure the SAP HANA client ODBC driver on your ArcGIS Pro machines as you use when you configure the data source name for the ODBC driver on your ArcGIS Server machines. If you do not use the same name, you will encounter problems when publishing, because ArcGIS compares the connection strings of the data being published and the database that is registered.

  1. Open the ODBC Data Source Administrator (64 bit).

  2. Click the System DSN tab in the ODBC Data Source Administrator (64 bit) and click Add.

    The Create New Data Source dialog box appears.

  3. Choose the SAP HANA ODBC client and click Finish.

  4. Populate the Data Source Name, Description, and Server:Port information for your database.

  5. In the TLS/SSL section, check Connect to the database using TLS/SSL and Validate the TLS/SSL certificate.

  6. Open the advanced ODBC setup dialog box and add the following key value to the Special property settings section: SPATIALTYPES=1. Click OK to apply the changes and close the ODBC Advanced Setup dialog box.

    Note:

    You can skip this step if you are using ArcGIS Server with a supported version of SAP HANA 2.0 or later.

  7. Click OK on the ODBC client setup and ODBC Data Source Administrator to close them.

Create a database connection

You must have a database connection (.sde file) that authenticates the connection to the database.

You can call the ArcPy CreateDatabaseConnection function from one of the machines in the ArcGIS Server site that needs to connect to the database. See Create Database Connection in the ArcGIS Pro help for information about running this function.

You must save user information with the connection file to use the database connection file with ArcGIS Server.

Register the connection file

To allow ArcGIS Server sites to access the data, use the database connection file you created to add a registered data store in ArcGIS Pro or add a data store item in the portal.