Overview
You will learn
- How to create and test an SAP HANA ODBC data source
- How to use an ODBC data source in an application
Prerequisites
- You have completed the first 3 tutorials in this mission.
Steps
Intro
Open Database Connectivity (ODBC) provides an API for accessing databases. Database vendors provide ODBC drivers for their database products. An application written to the ODBC standard can be ported to other databases that also provide an ODBC interface.
Linux and macOS users can set a custom application name by adding the
sessionVariable:APPLICATIONproperty to the data source definition in the.odbc.inifile as shown in the previous step. The following instructions only apply to Microsoft Windows.
The SAP HANA ODBC driver supports setting a custom application name using the sessionVariable:APPLICATION connection property. This value can be viewed in the CLIENT_APPLICATION column of the M_CONNECTIONS system view and may also appear in SAP HANA telemetry data.
Open ODBC Data Sources (64-bit) from the Microsoft Windows Start menu.
Select your SAP HANA data source and click Configure.

Configure ODBC application name Click Advanced in the lower-left corner of the configuration dialog.

Open ODBC advanced settings Click Add and enter the following values:
Property:
sessionVariable:APPLICATIONValue:
ODBC Application- You can replace ODBC Application with your preferred application name.

Add ODBC connection property Click OK to close the Advanced dialog.
Click OK on each remaining configuration window to save the changes.
The custom application name will not be saved unless you confirm and close all open configuration dialogs by clicking OK.
An application that supports ODBC can now make use of the created data source. One example on Windows is Microsoft Excel.
Microsoft Excel and the SAP HANA client must use the same architecture (both 32-bit or both 64-bit).
The Excel version can be checked under File | Account | About Excel.

If needed, the 32-bit installer for SAP HANA client is available from the SAP Software Centre site and can be installed into a separate directory such as C:\SAP\hdbclient32.
The following steps demonstrate how to use Microsoft Excel to query data in SAP HANA using the ODBC connector.
On Microsoft Windows, open Microsoft Excel.
In the Data tab, go to Get Data | From Other Sources | From ODBC.

Excel ODBC Select the previously created data source that contains the connection information to an SAP HANA database.

Excel DSN Enter the credentials.

Credential Screen Select a schema and table, then press Load.

Browse Schema The selected data is now imported into a Microsoft Excel spreadsheet.

Excel Show Data One further option for some tools is to provide the connection details directly to an ODBC enabled application as shown below.

Excel ODBC Connection String For further information on programming an application to use the ODBC client driver, see ODBC Application Programming.
Congratulations! You have configured an ODBC data source to contain connection information for a SAP HANA database and used that data source from Microsoft Excel.
Resources
Discussion
Share feedback on this tutorial or join the conversation in SAP Community.









