Hibernate supports third-party connection pools. the officially recommended connection pools are C3P0, Proxool, and DBCP. Note the following three points when configuring the connection pool:
Hibernate supports third-party connection pools. the officially recommended connection pools are C3P0, Proxool, and DBCP. Note the following three points when configuring the connection pool:
Hibernate supports third-party connection pools. the officially recommended connection pools are C3P0, Proxool, and DBCP. Note the following three points when configuring the connection pool:
1. Apche's DBCP is supported in Hibernate2, but it is no longer recommended in Hibernate3. The official explanation is that this connection pool has defects. If you need to use DBCP in Hibernate3 for some reason, we recommend that you use the JNDI method.
2. By default (that is, if the connection pool is not configured), Hibernate uses the built-in connection pool. However, this connection pool has poor performance and many bugs. (the default value is used in the program connecting to the oralce database. As a result, if no operation is performed in one night, an error is reported that the connection has expired ), therefore, the official recommendation is only available in the development environment.
In addition, some foreign articles say that C3P0 has some defects in performance (its algorithm is not optimal), and Proxool is the one with the least negative comments.
If you really want to use C3P0, refer to the following method:
1. Add jar package -- c3p0-0.9.1.jar for the project
2. Add in hibernate. cfg. xml
30
2
5000
100
3000
2
False
Org. hibernate. connection. C3P0ConnectionProvider
True
Complete these two steps.
We recommend that you use Proxool to configure the connection pool as follows:
1. Obtain proxool
Download from proxool official website and use hibernate version compatible with the proxool-x.x.x.jar, the official website address is
2. Compile the proxool configuration file
In the same directory as hibernate. cfg. xml, create the file ProxoolConf. xml with the following content:
ServerPool
Jdbc: Oracle: thin: @ 101.162.172.79: 1600: yytest
Oracle. jdbc. driver. OracleDriver
90000
20
5
100
10
Note: in actual use, it is best to remove the comment; otherwise, an error may be reported, as if I reported an error (Proxool Provider unable to load JAXP aggregator file: proxool. xml )..
Related reading:
Java Web Database Connection Pool proxool configuration details
Hibernate details: click here
Hibernate: click here
Hibernate Chinese manual PDF