Although hibernate comes with a connection pool, it also supports some other connection pools. However, looking at all aspects of the information, I think it is still the mainstream proxool connection pool. Now I want to record the configuration method for future use:
1. hibernate. cfg. xml
<Session-factory>
<Property name = "hibernate. Connection. provider_class">
Org. hibernate. Connection. proxoolconnectionprovider
</Property>
<Property name = "hibernate. proxool. pool_alias"> mypool </property>
<Property name = "hibernate. proxool. xml"> proxool. xml </property>
<Property name = "show_ SQL"> true </property>
<Property name = "dialect"> org. hibernate. dialect. sqlserverdialect </property>
<Mapping Resource = "userinfo. HBM. xml"/>
</Session-factory>
2. proxool. xml
<Proxool>
<Alias> mypool </alias> <! -- Alias of the connection pool -->
<Driver-URL>
JDBC: Microsoft: sqlserver: // localhost: 1433; databasename = testhibernate; selectmethod = cursor
</Driver-URL>
<! -- JDBC driver -->
<Driver-class> com. Microsoft. JDBC. sqlserver. sqlserverdriver </driver-class>
<Driver-Properties>
<Property name = "user" value = "sa"/>
<Property name = "password" value = "123"/>
</Driver-Properties>
<! -- The proxool automatically detects the time interval (in milliseconds) of each connection status. When idle connections are detected, the system immediately recycles the connection status and destroys the connection timeout. -->
<House-keeping-sleep-time> 90000
<! -- Indicates the maximum number of requests waiting in the queue because no idle connections can be allocated. User connections exceeding the number of requests will not be accepted. -->
<Maximum-New-connections> 20 </maximum-New-connections>
<! -- Minimum number of idle connections maintained -->
<Prototype-count> 5 </prototype-count>
<! -- The maximum number of connections allowed. If the connection is exceeded, the requests are placed in the queue. the maximum number of waiting requests is determined by maximum-New-connections. -->
<Maximum-connection-count> 100 </maximum-connection-count>
<! -- Minimum connections -->
<Minimum-connection-count> 10 </minimum-connection-count>
</Proxool>
Configure the above two files! Not too difficult...