Oracle - connection Pooling with spring framework

后端 未结 5 2006
萌比男神i
萌比男神i 2021-02-01 11:38

We are trying to implement Oracle connection pooling with the help of Spring Framework. We are using DBCP connection pooling method. However the integration between DBCP and spr

5条回答
  •  有刺的猬
    2021-02-01 12:07

    You should not implementing your own pooling, if that's what you're using. Tomcat already does that for you, instead, define a data source in Tomcat, and have your ORM framework use it (when you define your Tomcat data source, you can specify the pool configurations there).

    If you could post some code snippets, specifically, the relevant Spring context configurations, I can help provide you with how you'd do this.

    Here's Tomcat documentation that shows you exactly how you do that:

    • http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html

    Incidentally, Tomcat uses DBCP also, and it's better to rely on JNDI, as it makes your code more portable (from one environment to another - e.g., dev to staging to production, or even across application servers - e.g., to WebSphere, WebLogic etc).

提交回复
热议问题