Druid Database Connection Pool configuration

Source: Internet
Author: User

Druid First is a database connection pool, but it is not just a database connection pool, it also contains a proxydriver, a series of built-in JDBC component libraries, a SQL Parser. Druid supports all JDBC-compliant databases, including Oracle, MYSQL, Derby, Postgresql, SQL Server, H2, and more. The Druid is optimized for Oracle and MySQL, such as Oracle's PS Cache memory footprint optimization and MySQL ping detection optimization. The druid has significant advantages in monitoring, scalability, stability, and performance. Druid provides an extended API for Filter-chain mode that can write its own filter to intercept any method in JDBC, and can do anything on it, such as performance monitoring, SQL auditing, user name password encryption, logging, and so on.  Configuration    In order to facilitate the migration, Druid Configuration and DBCP is basically consistent, if you originally used DBCP, migration is very convenient, Just need to change the corg.apache.commons.dbcp.BasicDataSource to Om.alibaba.druid.pool.DruidDataSource just fine.  <bean id= "DataSource" class= "Com.alibaba.druid.pool.DruidDataSource" init-method= "Init" destroy-method= " Close ">     <property name=" url "value=" ${jdbc_url} "/>     <property name= "username" value= "${jdbc_user}"/>    <property name= "password" value= " ${jdbc_password} "/>         <property name=" Filters "value=" Stat "/>     <property name=" maxactive "value="/>     <property name= "InitialSize" value= "1"/>    <property name= "maxWait" value= "60000"/ >    <property name= "Minidle" value= "1"/>     <property Name= "Timebetweenevictionrunsmillis" value= "60000"/> &Nbsp;  <property name= "Minevictableidletimemillis" value= "300000"/>      <property name= "Validationquery" value= "select ' X '"/>    <property name= " Testwhileidle "value=" true "/>    <property name=" Testonborrow "value=" false "/>     <property name= "Testonreturn" value= "false"/>          <property name= "Poolpreparedstatements" value= "true"/>    <property name = "Maxpoolpreparedstatementperconnectionsize" value= "/></bean>" in the above configuration, usually you need to configure the URL, username, password, Maxactive these three items.

Druid database Connection pool configuration

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.