Skip to Content

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 ?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers