Hi, I want to establish Kerberos database connection using Spring + Hibernation combination. I am trying to customize the org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider's getConnection() method to pass Kerberos credentails like krb5.conf file path, keytab file path, kerberos principal and obtain the connection. using below class
import java.sql.Connection; import java.sql.SQLException;
import org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider;
import com.ubs.ct.infrastructure.db.connection.DatabaseConnectionException; import com.ubs.ct.infrastructure.db.connection.OracleDatabaseConnectionProvider;
public class HibConnection extends LocalDataSourceConnectionProvider { public HibConnection() { System.out.println("**--**-- Inside HibConnection's constructor "); } @Override public Connection getConnection() throws SQLException { System.out.println("**--**-- Inside getConnection and this is my connection"); Connection con=null; try { con = (new OracleDatabaseConnectionProvider()).getConnectionFromDataSource("krb5.conf.path", "keytab_file_path", "principal_name", this.getDataSource()); } catch (DatabaseConnectionException e) { // TODO Auto-generated catch block e.printStackTrace(); } return con; } }
But the code does not pick up this class even after specifying this class as the value of hibernate.connection.driver_class
Please let me know the exact way to override the default getConnection() behavior of Hibernate
_________________ Thanks and Regards, Umesh Pathak
|