cancel
Showing results for 
Search instead for 
Did you mean: 

Need sample jdbc java program with kerberos authentication ?

Hi All,

I need the sample java program with kerberos authentication.

I have configured kerberos authentication in SAP HANA Database server.

I tried Single Sign-On through SAP HANA Studio.

Now i want to try SSO using jdbc java client.

Can anyone provide sample jdbc java program with kerberos authentication ?

In traditional way, We take database user and password to get connection.

   static final String JDBC_DRIVER = "com.sap.db.jdbc.Driver";  
   static final String DB_URL = "jdbc:sap://10.0.0.1:31000";

   static final String USER = "username";
   static final String PASS = "password";
   
   public static void main(String[] args) {
   Connection conn = null;
   Statement stmt = null;
   try{
      Class.forName("com.sap.db.jdbc.Driver");
      System.out.println("Connecting to a SAP HANA Database...");
      conn = DriverManager.getConnection(DB_URL, USER, PASS);
      System.out.println("Connected database successfully...");
   }
 }catch(SQLException se){
      se.printStackTrace();
   }catch(Exception e){
      e.printStackTrace();
   }finally{
      try{
         if(conn!=null)
            conn.close();
      }catch(SQLException se){
         se.printStackTrace();
      }
   }
 }
}

Can anyone help me for kerberos authentication ?

View Entire Topic
former_member657223
Discoverer
0 Kudos

kulbhushan333 Did you ever get this working? I need help on this too, or even the connection string with kerberos for that matter...I am just trying to connect to HANA from DBeaver.