How to configure SAS/ACCESS Interface to SAP HANA on SAS Viya?
The process itself is described in SAS® Viya® 3.4 Administration -> Linux Deployment Guide -> Configure SAS/ACCESS Interface to SAP HAN..., but here is how I went through that.
First of all, you have to download SAP HANA Client from the SAP Support Portal. After you install/unpack the client, you should have something like that:
The next step will be installing unixODBC. You have to install that package on all of your nodes, so in order to simplify the installation process, run a command shown below from your Ansible playbook directory:
ansible all -m yum -a "name=unixODBC state=present" --become
After that create /usr/lib64/hdb directory on your primary controller. And move SAP HANA client libraries to that folder:
sudo mkdir /usr/lib64/hdb
sudo cp -r /path/to/your/client/folder/* /usr/lib64/hdb/
Synchronize that directory with each CAS server node:
ansible "sas-casserver-worker" -m copy -a "src=/usr/lib64/hdb dest=/usr/lib64" --become
Please note libodbcHDB.so requires libaio.so.1, by default this library isn’t installed on RHEL:
Let’s install the package on all machines:
ansible all -m yum -a "name=libaio state=present" --become
At this step the installation process is over, now we need to configure unixODBC as well as SAS Studio and the CAS server.
1. Create /etc/odbc.ini and add these lines to a file. Do not forget to update both server name and port:
[SAPHANADSN]
DRIVER = /usr/lib64/hdb/libodbcHDB.so
SERVERNODE=server.example.com:30015
2. For each host that is specified in the [programming] host group, edit these files:
sudo vi /opt/sas/viya/config/etc/workspaceserver/default/workspaceserver_usermods.sh
sudo vi /opt/sas/viya/config/etc/sysconfig/compsrv/default/sas-compsrv
and add the following lines to them:
export ODBCINI=/etc/odbc.ini
export ODBCINST=/etc/odbcinst.ini
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64/hdb
3. On the CAS controller, edit the cas_usermods.settings file:
sudo vi /opt/sas/viya/config/etc/cas/default/cas_usermods.settings
add the following lines:
export ODBCINI=/etc/odbc.ini
export ODBCINST=/etc/odbcinst.ini
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64/hdb
cas_usermods.settings needs to be syncronized with all CAS server worker nodes:
ansible "sas-casserver-worker" -m copy -a "src=/opt/sas/viya/config/etc/cas/default/cas_usermods.settings dest=/opt/sas/viya/config/etc/cas/default" --become
4. Test your connection to the SAP HANA server from the command line:
isql SAPHANADSN USERNAME PASSWORD -v
5. If you were able to connect from the command line, you should be able to connect to the SAP HANA from SAS session:
libname hanalib SASIOHNA server='server.example.com' port=30015 user=username password=yourpassword;
I hope this information will be useful to you. Let me know if you have any questions about that.
Hi Alexal,
just wondering how SAS get through into schema level, i mean when querying using proc sql or register table the generated query include the schema name.
for example : select * from schema.table, not just select * from table.
Thank you
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.