How to connect to SAP HANA using JDBC

Recently I had to connect a Java application to SAP HANA and I made some notes along the way:

The first step is to get the SAP HANA JDBC driver, a file called ngdbc.jar. The quickest way is to download the SAP Hana Cloud Platform SDK from here: https://tools.hana.ondemand.com/#cloud

Choose the latest “Java Web Tomcat 8” from the download section (a package starting with neo-).

Unzip the archive to any location in your machine.

Extract the JDBC driver (ngdbc.jar) from the archive. You will find the driver in the archive inside a hidden folder under: repository/.archive/lib/ngdbc.jar)

Use the driver with the connection string

jdbc:sap://<server>:<port>

Where the port is

3<instance_number>15

So if your instance number is 10, the port would be 31015.

The custom driver class name is

com.sap.db.jdbc.Driver

 

 

By Daniel Pradilla

I'm an Engineer and my main objective is to help people solve real world problems using readily available technologies. I've been doing it since I was a kid.

Discover more from Daniel Pradilla

Subscribe now to keep reading and get access to the full archive.

Continue reading