Configure the proxool connection pool in hibernate!

Source: Internet
Author: User

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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.