Convert database connection pool to HIKARICP

Source: Internet
Author: User

HIKARICP claims to be the fastest, today to change over to try

1. Modify the configuration file

  1. <!--Hikari Datasource--
  2. <Bean id= "dataSource" class="Com.zaxxer.hikari.HikariDataSource" destroy-method= "Shutdown">
  3. <property name= "driverclassname" value="${jdbc.driver}" /> <!--No need to specify, Unless the system does not automatically identify
  4. <property name="Jdbcurl" value="${jdbc.url}" />
  5. <property name="username" value="${jdbc.username}" />
  6. <property name="password" value="${jdbc.password}" />
  7. <!--configured to True when connecting to a read-only database, guaranteed security -
  8. <property name="readOnly" value= "false" />
  9. <!--The maximum length of time (in milliseconds) to wait for a connection pool to allocate a connection, a connection that exceeds the length of time that is not available SqlException, default: 30 Seconds--
  10. <property name= "connectiontimeout" value="30000" />
  11. <!--The maximum length of time (in milliseconds) for a connected idle state, and the timeout is released (retired), default: 10 minutes --
  12. <property name= "idleTimeout" value="600000" />
  13. <!--The lifetime of a connection (milliseconds), timed out and not being used is released (retired), default: 30 minutes, recommended setting is 30 seconds less than database timeout, refer to mysql wait_timeout parameter (show variables Like '%timeout% ';) --
  14. <property name= "maxlifetime" value="1800000" />
  15. <!--The maximum number of connections allowed in the connection pool. Default value: 10; Recommended formula: ((Core_count * 2) + effective_spindle_count)- -
  16. <property name= "maximumpoolsize" value= " /> "
  17. </Bean>

2. Load the jar package 
  1. <dependency>
  2. <groupId>com.zaxxer</groupId>
  3. <artifactid>hikaricp</artifactid>
  4. <version>2.4.6</version>
  5. <scope>compile</scope>
  6. </Dependency>

This is the end, but after the start error, and no connection on

3. Replace the Oracle package (the database is using Oracle)

  1. <dependency>
  2. <groupId>com.oracle</groupId>
  3. <artifactid>ojdbc6</artifactid>
  4. <version>${oracle.driver.version}</version>
  5. <scope>runtime</scope>
  6. </Dependency>
    1. <oracle.driver.version>11.2.0.3</oracle.driver.version>

Used to be oracle14, use the Times wrong link is not on.

Convert database connection pool to HIKARICP

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.