java - HikariCP with Kerberos JDBC for Connection Pooling -
my application runs spring framework , have connected hive server kerberos authentication along hikaricp.
i looked examples of spring security kerberos not relate hikari cp. following code getting connections drivermanager. how use datasource , hikaricp ?
private string gethadoopjdbcurl() throws ioexception { system.setproperty("javax.security.auth.usesubjectcredsonly", "false"); system.setproperty("java.security.krb5.conf", enviroment.getproperty(kerberos_config_file)); org.apache.hadoop.conf.configuration configuration = new org.apache.hadoop.conf.configuration(); configuration.set("hadoop.security.authentication", "kerberos"); configuration.set("hadoop.security.auth_to_local", connectiondetails.getsecurityauth()); usergroupinformation.setconfiguration(configuration); if (!(connectiondetails.getkerberosusername().equalsignorecase(utility.empty_string) || connectiondetails.getkerberospassword().equalsignorecase(utility.empty_string))) { usergroupinformation.loginuserfromkeytab(connectiondetails.getkerberosusername(), connectiondetails.getkerberospassword()); } return string.join("", connectiondetails.getjdbcurl(), "/", aggregatedetails.getdatabasename(), ";", connectiondetails.getprincipal()); } public connectiondetails getconnectiondetails() throws parseexception, classnotfoundexception, sqlexception, ioexception { string jdbcurl = utility.empty_string; class.forname(connectiondetails.getdriver()); if (connectiondetails.gettype().equalsignorecase(connectiondetails.hadoop_persistence)) { jdbcurl = gethadoopjdbcurl(); } connectiondetails.setconnection(drivermanager.getconnection(jdbcurl)); return connectiondetails; }
Comments
Post a Comment