-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Customize LocalDataSourceConnectionProvider
PostPosted: Wed Oct 30, 2013 7:19 am 
Newbie

Joined: Wed Oct 16, 2013 2:28 am
Posts: 2
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.