Using Spring to instantiate a DBCP DataSource with Kerberos

V

Varian

Hi,

I am using the Spring framework with Hibernate. I am currently
instantiating and populating a DBCP BasicDataSource
(org.apache.commons.dbcp.BasicDataSource) with credentials using
Spring. The BasicDataSource uses Sybase's JDBC drivers to connect to a
Sybase database.

I would like to use Kerberos instead of passing in the credentials in
the Spring xml file. To do this, I have to set some of the connection
properties like REQUEST_KERBEROS_SESSION and SERVICE_PRINCIPAL_NAME.
However, BasicDataSource has no setter method for it's proteted
connectionProperites field, so I don't see how I can use Spring to do
this.

I noticed that BasicDataSourceFactory's createDataSource method takes a
Properties argument and returns a BasicDataSource. However, I don't see
how this could be configured in a Spring xml file to give me a
BasicDataSource bean either, since it has to call a method.

Can anyone advise on how I can do this?

I haven't had any luck with Google or newsgroups and I hope this is the
correct group to post to. Thanks for your help in advance!

Regards,

-=Varian=-
 
V

Varian

Looks like Spring can use static factory methods to create beans by
specifying the factory class in the class attribute and also specifying
a factory-method attribute.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top