Setting up a JDBC connection to remote SAP HANA system


You are using the correct Port number for instance number “00”. Port number 300315, here 00 represents instance number of your HANA system.

Try using HANA client jar file ngdbc.jar instead of SAP Jar file.

try {
   Class.forName("com.sap.db.jdbc.Driver");
   String url ="jdbc:sap://xx.x.x.xxx:30015/DBNAME"; //IP Address of HANAsystem followed by Port number
   String user ="user";
   String password = "password";
   Connection cn = java.sql.DriverManager.getConnection(url, user, password);
   ResultSet rs = cn.createStatement().executeQuery("CALL Test.STORED_PROC");
   // ...Enter the action here
} catch(Exception e) {
   e.printStackTrace();
}

Updated on: 05-Dec-2019

657 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements