Skip to Content

Hi All,

The purpose of this document is to provide the concrete steps for connecting to SAP Hana Trial Instance on the cloud from your java program through JDBC.

Prerequisites

  • Eclipse plugin for Hana/ Hana Studio
  • Download Hana Client
  • Download Hana SDK.

Assumptions:

  • You have already connected to the Hana trial instance from Eclipse.

For JDBC connection, you need to establish a database tunnel.

If you have connected to you Hana cloud instance through eclipse, it has already done so.

But, the logon credentials are not available in Eclipse

To fetch the logon credentails, go the place where you have the Hana SDK and execute the following command.

hana.JPG

In the above command, p1941173713trial is the account name and p1941173713 is the username for your Hana cloud instance.(It will prompt for you HCP password)

Please note the username and password.

The password is a transient one.. for more information refer to the online help.

https://help.hana.ondemand.com/help/frameset.htm?9e3f90f2ead74229ac5c8848ed5bf292.html

Now , in your java program, user the username and password from above to connect using JDBC.

Please make sure that you have added the ngdbc.jar in the CLASSPATH of your java program.

ngdbc.jar has the SAP HANA JDBC driver and is available as part of the Hana client in the following location –

“SAP_HANA_CLIENT_Winx86_64\SAP_HANA_CLIENT_Winx86_64\client\JDBC”

………………….

Connection connection = null;

  try {                

  connection = DriverManager.getConnection(

  “jdbc:sap://localhost:30015/?autocommit=false”,”DEV_5G4LWB5DDR1BU2LZJ2GU3ZQ64″,”Bl0M0poWosSigO9″);                

  } catch (SQLException e) {

  System.err.println(“Connection Failed. User/Passwd Error?”);

  return;

  }

………………..

Alternative you can use the URL provided in the neo command above

connection = DriverManager.getConnection(

jdbc:sap://localhost:30215/?currentschema=NEO_4N6HYOS2M4R9A0EPMIOYZG58J”,“DEV_5G4LWB5DDR1BU2LZJ2GU3ZQ64″,”Bl0M0poWosSigO9”);    

…………..

Hopefully, this information will be useful for some people

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. Chandrashekhar Bakker

    Is this concept still working..? I’m trying to conenct to HANA DB but its giving me java heap space issue. I’m using the same syntax for creating connection. Please help. This is how i’m trying to conenct. Please help.

    con = DriverManager.getConnection(
    “jdbc:sap://<IP Address>:Portnum/’db name”,”username”,”password”);

    (0) 

Leave a Reply