Using Spring to instantiate a DBCP DataSource with Kerberos

Discussion in 'Java' started by Varian, Nov 30, 2005.

  1. Varian

    Varian Guest

    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=-
    Varian, Nov 30, 2005
    #1
    1. Advertising

  2. Varian

    Varian Guest

    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.

    Varian wrote:
    > 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=-
    Varian, Dec 1, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael Scovetta
    Replies:
    0
    Views:
    3,078
    Michael Scovetta
    Jun 4, 2003
  2. ck388
    Replies:
    0
    Views:
    3,770
    ck388
    Jun 6, 2003
  3. GaryM
    Replies:
    0
    Views:
    356
    GaryM
    Dec 31, 2003
  4. rmn190
    Replies:
    2
    Views:
    2,320
    Arne Vajhøj
    Jan 10, 2008
  5. Goldfish
    Replies:
    1
    Views:
    643
    Goldfish
    Nov 6, 2008
Loading...

Share This Page