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