Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
vikas_ohri2
Explorer
0 Kudos
2,029

In my previous test of Integrating R with HANA R Integration with HANA  - Test of "Outside In Approach" - Part 1

ODBC was used to make connection with  HANA Database on a Cloud Platform. Eventhough I used R environment to make the Database  connection and do SQL operations. ODBC should work similarly for any other Programming environments.

SAP supports variety of Integration technologies and methods to write interfaces to connect with its data, right from its native & proprietary RFC techniques (my favorite)  to some of the web based and open standards techniques.

This time i thought of using JDBC for making connections to HANA .Again I have used R in my example . It should work similarly if writing a Java based application. One of the key dependency is to use "ngdbc.jar" . This Jar file with its location need to specified in the Build path of Java application. It comes as part of HANA client install.  It is needed for integrating R environment with HANA as well.

I am using HANA on cloud , so i have to use secure Data base tunnel to connect and get my user credentials.

The JDBC works with on premise HANA install as well, however you may need to contact HANA system administrator for the parameters values to be used in the function calls.

The R Script snippet  using JDBC to connect to HANA is shared below

install.packages("RJDBC")

library("RJDBC")

drv <- JDBC("com.sap.db.jdbc.Driver", " <path of ngdbc.jar>", "'")

conn <- dbConnect( drv,"jdbc:sap://<host>:<port>/?currentschema=<your HANA Schema>", "HANA User ID", "HANA Password")

res <- dbGetQuery(conn, "select * from Schema.Table")

With correct system credentials put in the above R script,  and putting in the correct values of HANA Schema and Table name.

I was able to read the twitter messages stored in the HANA table. Snapshot image of the <res> shared below.

So in effect , Data can be read from HANA and brought back in a R data.frame Object which can be now used for further analysis.

So another successful test done to connect with HANA using R !! - this time using JDBC

Labels in this area