How To Install and Configure unixODBC For HANA

SCP_www.basisguru.com

In this article we will see how to install and configure unixODBC to connect from SAP HANA express edition server host to a client machine.

First, let us discuss each terminology in detail:

What is ODBC?

Open Database Connectivity also known as ODBC is a specification for a database application programming interface (API) which is independent of any Database or operating system.
With ODBC, single application can access different Database management systems with the same source code.
These data sources typically includes SQL Servers and Data Source with an ODBC Driver.

What is unixODBC?

unixODBC is an open source project that implements ODBC API.
It allows developers a tool to port Microsoft windows ODBC applications to other platforms.

Steps To Install & Configure unixODBC for HANA

  • Edit hosts file on the client machine
  • Install unixODBC driver manager.
  • Create .odbc.ini file on HANA host.
  • Connect to system using isql command

Let us discuss each step in detail:

1) Edit hosts file on the client machine

For Windows system ,Goto c:\Windows\System32\Drivers\etc\ and edit hosts file.

If client machine is unix/linux machine, we need to edit /etc/hosts file.

2) Install unixODBC Driver Manager On HANA

On HANA host machine (SUSE Linux), open the YaST as shown below with root in a terminal :

yast

From Software management , search for unixODBC.

Open the Action menu by pressing Tab key and then install it

Installation will take some time.

Exit YaST.

Installation Verification of unixODBC for HANA

We can verify the installation by executing command odbcinst from HANA host.
we should be able to get list of commands as shown below:

unixODBC for HANA

3) Create .odbc.ini file on HANA host

Login to HANA host with <SID>adm and goto /usr/SAP/<SID>/home directory.

su fedadm
cd /usr/sap/FED/home

Here, create .odbc.ini file

vi .odbc.ini

For each client machine add below entries:

[<DATABASE_NAME>]
servernode = <client_ip_address>:3<instance_number>13
#location of the unixODBC driver
driver = /usr/sap/<sid>/HDB<instance_number>/exe/libodbcHDB.so
description = <optional_description>
databasename = <your_database_alias>

In our case,

  • DATABASE_NAME = FED
  • servernode client IP= 192.176.2.1
  • instance number=01
[FEDCLIENT]
servernode = 192.176.2.1:30113
driver = /usr/sap/FED/HDB01/exe/libodbcHDB.so
description = database
databasename = CL1

Verification:

[email protected]:~$ odbcinst -j
unixODBC 2.3.1
DRIVERS………………………..: /etc/odbcinst.ini
SYSTEM DATA SOURCES..: /etc/odbc.ini
FILE DATA SORICES………: /etc/ODBCDataSources
USER DATA SOURCES…….:
SQLULEN SIZE………………: 8
SQLLEN Size………………….: 8
SQLSETPOSIROW Size…..: 8

4) Connect to system using isql command

We can connect to the client system using below command:

isql <DATABASE_NAME> <user> <password>

In our case,

isql FEDCLIENT SYSTEM <Password>