Announcement Announcement Module
No announcement yet.
Setting properties of JNDI Datasource Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Setting properties of JNDI Datasource

    I would like to get a Datasource via JNDI . Simple enough.

    But then also set the Properties of the retrieved Datasource.

    All via Spring Declarative Bean Configuration.

    Is this possible? How? Via ProxyInterface?


    I have a oracle.jdbc.pool.OracleDataSource JNDI Resource in Tomcat.
    The OracleDataSource only has a

    public  void setConnectionCacheProperties(Properties properties)
    to configure the Cache and Tomcat ResourceParams does'nt know about Properties.

    And since Spring does, it that maybe i can configure the ConnectionCacheProperties with Spring.

    Any hints are greatly welcomed.


  • #2
    More Background:

    The Oracle JDBC Driver supports since 10g what they call Implicit Connection Caching.

    This seems for shops with Oracle Databases a good option.
    Most likely anybody using the Oracle Application Server 10g with be useing this feature.

    It supports for instance setting User Credentials upon getConnection().
    The only other Pool i know of, which supports this is the C3P0 Pool.
    Commons DBCP certainly does'nt.

    Now not all are using the Oracle AS, but prefer to use like Tomcat, specially since one has Spring ;-) .

    The draw back in terms of Connection Pooling as mentioned in my previous
    message, is that the Pool can only be configured through Properties,
    which Tomcat doesnt support for configuring JNDI Resources, as far as i know.

    What i did to workaround this problem is :

    Create a Subclass of DelegatingDataSource, which in afterPropertiesSet
    sets the properties, which are configured through Spring.

    Don't know if this is the best solution, but it works ;-)

    Another option could be a Bean Wrapper around ConnectionCacheManager of Oracle, with which the Cache could be managee in an own Servlet.

    Any other suggestions?