Quantcast
Channel: SCN : Discussion List - SAP HANA Cloud Platform Developer Center
Viewing all articles
Browse latest Browse all 3131

External HANA connection

$
0
0

Hello everyone,

I need to connect to an external HANA server (not the one provided by JPaaS).

I know this goes against the principles of JPaaS but i need to do it.

 

This is the code i wrote to connect using JDBC:

 

String hanaServer = ""; //Here goes the IP address of the server

String hanaPort = "30015";

String hanaUser = "test";

String hanaPassword = "test";

 

         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");   

        java.sql.Connection conn=DriverManager.getConnection("jdbc:odbc:"+hanaServer+":"+hanaPort, hanaUser, hanaPassword);   

        Statement stmt = conn.createStatement();   

        ResultSet rs = stmt.executeQuery( "SELECT * FROM \"_SYS_BI\".\"BIMC_ALL_CUBES\"" );    //just a SQL query for testing the connection

 

         while( rs.next() )   

         {   

               System.out.println( rs.getString(1));   

               System.out.println( rs.getString(2));    

         }   

 

 

         rs.close() ;   

         stmt.close() ;   

         conn.close() ;

 

When i run this code, i get the following error

 

[unixODBC][Driver Manager]Data source name not found, and no default driver specified

 

Does anybody know how can i make this work?

 

Thanks!

Julian


Viewing all articles
Browse latest Browse all 3131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>