cancel
Showing results for 
Search instead for 
Did you mean: 

Integrating HANA database with JAVA application

Former Member
0 Kudos

Hi Everyone,

I am very new to SAP. I develop applications in java using oracle/SQL server database. Now my requirement is to use SAP HANA database in java and deploy in HCP. I am trying to establish a connection to sap db from java application but unable to connect. I registered the driver com.sap.dbtech.jdbc.DriverSapDB and trying to get the connection Object using

"jdbc:sapdb://localhost:30015/<myinstancename>?timeout=0","<my trial user id on HCP>","<my password on HCP>".

I am neither getting any exception nor getting the connection object.

Could any one help me in solving the issue?

Regards,

Ambica Sona. D

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member193379
Active Contributor
0 Kudos

Hi Ambica,

Please have a look of the below help link.

Connect to SAP HANA via JDBC - SAP HANA Developer Guide for SAP HANA Studio - SAP Library

Thanks,

Hamendra

Former Member
0 Kudos

Thank You Hamendra.

The link is talking about the desktop application and it is working by opening a database tunnel using Console Client. When i use the same URL, Schema, User and password given by tunnel and create a web application it is giving No suitable driver found. I have given "com.sap.dbtech.jdbc.DriverSapDB" as the driver and the related jar i included in the build path.

Do i have to add the jars in any other place too?

Regards,

Ambica Sona. D

former_member193379
Active Contributor
0 Kudos

Hi Ambica,

I have not done specially for HANA but as per my experience with SAP systems, you have to perform the below activities

1. Copy the <driver>.jar file to the Library directory of Eclipse project.

2. Copy the <driver>.dll to the following directory, if you are using Windows. C:\WINNT\System32

Please update with outcome.

Thanks,

Hamendra

MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Ambica,

even though sapdbc.jar does not have a native library, still a remark to Hamendra's remark. You should never copy a shared library not belonging to the Windows System32 directory. This is an approach that can cause a lot of trouble. If you ever need a native library for a JDBC driver, make sure it can be loaded by adding it to a place where Java is looking for it in java.library.path. Best in one that is specifically added for this application.

With regards to eclipse it certainly helps only at dev time. Simply make sure the JAR is in the claspath or can be found by some other classloader than the system class loader that is visible by your application.

Best regards,

Markus

Former Member
0 Kudos

I already added the sapdbc.jar in my application's library as well as in the eclipse build path. Still i am getting the error as, java.sql.SQLException: No suitable driver found for jdbc:sap:.... Here the Java is registering the SAP JDBC driver but issue is at creating the connection.

If i don't add it in library i get java.lang.ClassNotFoundException: com.sap.dbtech.jdbc.DriverSapDB and even the driver will not be registered.

I tried with ngdbc.jar also and did not get success. The same way is working for a normal desktop application but not with a web application.

Regards,

Ambica Sona. D