Hi all,
I am trying to connect HANA from Java. Here is my code:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
java.sql.Connection conn = java.sql.DriverManager.getConnection("jdbc:odbc:HANA:PORT", "username", "password");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT Statement);
while (rs.next()) {
//
}
rs.close();
stmt.close();
conn.close();
And I get error: "[unixODBC][Driver Manager]DRIVER keyword syntax error"
Anyone to help me about this?
Did you create your ODBC "User DSN" and then tried to connect? it should work!
Regards,
Krishna Tangudu
I am trying to connect HANA from a hosting service. Is it possible to connect without creating ODBC?
Hi
If you mean by hosting services are you talking about Amazon ? Do you have access to the system where HANA server is installed then you can try creating one on that system ,may be it would resolve the problem.As per my understanding creating ODBC connection on either side works, without ODBC I doubt there is a possibility.
Thanks
Santosh
Hi,
I have a shared hosting. My java code hosted there. And HANA server is in my location. I am trying to connect HANA from Java which is hosted in shared hosting. So I dont have chance to a ODBC connection.
Hi
if HANA server is in your location, you can create ODBC on the system where HANA server is running.am I missing some thing ? first try installing HANA client & studio in that machine.
Thanks
Santosh Varada
Any step by step guide for that? you want me to install HANA Client & Studio on a SuSE machine? Really? If I want to connect from .Net code anyone knows how to do that?
Why not use the SAP HANA jdbc client instead of odbc. Via driver "com.sap.db.jdbc.Driver" and connection URL: jdbc:sap://" + hostName + ":" + port
Hi Onno,
I am looking for that! Any jars for jdbc? I couldnt find them. I will try that but I dont have access to HANA now.
Hi Erhan,
Download and install the HANA Client Libraries from http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/webcontent/uuid/402aa158-6a7a-2f10-0195-f43595f6fe5f.
You will find the ngdbc.jar you need in c:\Program Files\sap\hdbclient
--Juergen
With ngdbc.jar of the HANA Client and the following code you can connect to HANA:
Class.forName("com.sap.db.jdbc.Driver");
java.sql.Connection conn = java.sql.DriverManager.getConnection("jdbc:sap://HANA:PORT", "username", "password");
etc..