Hibernate- connection pool

  • When a connection pool is not specified, the default use its own connection pool, for development and testing only
  • Use Tomcat connection pool
  • C3P0
    • maven import C3P0

      <dependency>

      <groupId>org.hibernate</groupId>

      <artifactId>hibernate-c3p0</artifactId>

      <version></version>

      </dependency>

    • hibernate add configuration using C3P0

      <property name="connection.provider_class">

      org.hibernate.c3p0.internal.C3P0ConnectionProvider

      </property>

      <property name="hibernate.c3p0.min_size">5</property>

      <property name="hibernate.c3p0.max_size">10</property>

      <property name="hibernate.c3p0.max_statements">50</property>

      <property name="hibernate.c3p0.timeout">3600</property>

      <property name="hibernate.c3p0.idle_test_period">60</property>

      <property name="hibernate.c3p0.acquire_increment">2</property>

The main property

Description ( time in seconds )

min_size

The minimum number of connections

max_size

Maximum number of connections

max_statements

statement maximum number of

timeout

After the timeout delete the connection

idle_test_period

Check idle connection interval

acquire_increment

Number of database connections after the new connection with the

  • Proxool

Guess you like

Origin www.cnblogs.com/AlMirai/p/12546339.html