Oracle - connection Pooling with spring framework

后端 未结 5 2009
萌比男神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 11:59

    I use C3PO to establish the connection. It has also the advantage to do connection pooling for you. Just define a datasource bean of type e.g. com.mchange.v2.c3p0.ComboPooledDataSource (or similar) through your spring config files. Before I run into troubles with connection pooling, I even used one of spring (DriverManagerDataSource) that is not advised for production use, because it is not actually doing the connection pooling.

    Here is an example spring configuration.

    
        
        
        
        
        
        
        
        
        
        
    

    Spring then injects the dataSource bean into Hibernate and all is well. You will also need to have the c3pO jar file on your classpath...

提交回复
热议问题