on 06-16-2015 12:26 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
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
User | Count |
---|---|
86 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.