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

Soy arquitecto de software y ayudo a la gente a mejorar sus vidas usando la tecnología. En este sitio, intento escribir sobre cómo aprovechar las oportunidades que nos ofrece un mundo hiperconectado. Cómo vivir vidas más simples y a la vez ser más productivos. Te invito a revisar la sección de artículos destacados. Si quieres contactarme, o trabajar conmigo, puedes usar los links sociales que encontrarás abajo.

Discover more from Daniel Pradilla

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

Continue reading