Alibaba/druid FAQ

Source: Internet
Author: User
Tags memory usage sql injection wrapper jboss maven central
1,363 Fork895

Renfufei edited this page in Sep 2014 · Wuyi Revisions PagesBenchmark_aliyun Contributors dbcp Migration Druid Change Log Druid Monitor design druiddatasource dynamic configuration druiddatasource Statistic data log output format Druiddatasource Configuration Druiddatasource Configuration Properties list Druid How to configure the master-slave, have automatic recognition SQL Read only write policy. Druid Support for fair mode issues like WebLogic multiple data source Druid Locks Evalvisitor FAQ Home Show the more pages ... Clone this wiki locallyClone in Desktop

中文版 | Chinese

Welcome you to use Druid, FAQ here to answer, I hope to help you. 1. What is Druid.

Druid is the best database connection pool in the Java language. Druid can provide powerful monitoring and extension capabilities. 2. Where to download Druid

Download the official version:
Maven Central Warehouse: Http://central.maven.org/maven2/com/alibaba/druid/
Alibaba open Source Download: Http://code.alibabatech.com/mvn/releases/com/alibaba/druid/

Snapshot version download
Http://code.alibabatech.com/mvn/snapshots/com/alibaba/druid/ 3. How to get Druid source

Driud is an open source project, the source code hosted on the GitHub, the origin of the warehouse address is https://github.com/alibaba/druid. At the same time, each Druid release of the official version and snapshots, the source code will be packaged, you can download from the above address to find the relevant version of the source code 4. How to configure Maven

After the Druid 0.1.18 version is released to the MAVEN central repository, you only need to add dependency to the project's pom.xml. For example:

    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactid>druid</artifactid >
        <version>${druid-version}</version>
    </dependency>

You can also select the Maven warehouse to find the public warehouse address: Http://www.mvnrepository.com/artifact/com.alibaba/druid 5. How to open the Druid monitoring statistic function

Druid Monitoring statistics function is implemented through Filter-chain extension, if you want to turn on the monitoring statistics function, configuration statfilter, specifically look here: https://github.com/alibaba/druid/wiki/%E9%85% 8d%e7%bd%ae_statfilter 6. How to use the Druid built-in monitoring page

Built-in monitoring page is a servlet, specific configuration look here: https://github.com/alibaba/druid/wiki/%E9%85%8D%E7%BD%AE_StatViewServlet%E9%85%8D%E7% Bd%ae 7. How to configure Web and Spring Association monitoring in built-in monitoring. Web Association Monitoring Configuration
Https://github.com/alibaba/druid/wiki/%E9%85%8D%E7%BD%AE_%E9%85%8D%E7%BD%AEWebStatFilter Spring Association Monitoring Configuration
Https://github.com/alibaba/druid/wiki/%E9%85%8D%E7%BD%AE_Druid%E5%92%8CSpring%E5%85%B3%E8%81%94%E7%9B%91%E6%8E %a7%e9%85%8d%e7%bd%ae 8. How to configure defense SQL injection attacks

Druid provides Wallfilter, which is based on SQL Semantic analysis to implement defense against SQL injection attacks. Specific configuration look here: Https://github.com/alibaba/druid/wiki/%E9%85%8D%E7%BD%AE-wallfilter 9. Druid No reference configuration

Different business scenarios require different requirements, you can use our reference configuration, but it is recommended that you carefully read the relevant documents, to make a custom configuration after understanding. Https://github.com/alibaba/druid/wiki/%E9%85%8D%E7%BD%AE_DruidDataSource%E5%8F%82%E8%80%83%E9%85%8D%E7%BD%AE 10. I would like to log records of the SQL executed by JDBC, how to configure

Druid offers Log4jfilter, Commonslogfilter and Slf4jfilter, specific configuration see here https://github.com/alibaba/druid/wiki/%E9%85%8D%E7%BD% Ae_logfilter 11. My program may have a connection leak, what's the way.

Druid provides a variety of means of monitoring connection leakage, specifically look here: https://github.com/alibaba/druid/wiki/%E8%BF%9E%E6%8E%A5%E6%B3%84%E6%BC%8F%E7%9B%91% e6%b5%8b 12. The use of Pscache in Druid will have a large memory footprint problem.

Connecting Oracle databases, opening Pscache, and having excessive memory usage in other database connection pools, Druid is the only connection pool to solve this problem. Specifically look here: http://code.alibabatech.com/wiki/pages/viewpage.action?pageId=6951277 13. There is no comparison with other database connection pools. Comparison of various database connection pools http://code.alibabatech.com/wiki/pages/viewpage.action?pageId=6951797 14. What to look for when migrating from other connection pools. parameter Reference comparison of different connection pools: http://code.alibabatech.com/wiki/pages/viewpage.action?pageId=6947005 dbcp Migration https:// GITHUB.COM/ALIBABA/DRUID/WIKI/DBCP%E8%BF%81%E7%A7%BB 15. Is there any exceptionsorter in the druid similar to the JBoss datasource

Exceptionsorter is an excellent feature of JBoss DataSource, Druid also has the same function of Exceptionsorter, but not manually configured to automatically identify the effective. Specifically look here: Http://code.alibabatech.com/wiki/display/Druid/ExceptionSorter 16. Why the Maxidle in the druid is useless.

Maxidle is druid to facilitate DBCP user migration, Maxidle is a confusing concept. The connection pool should only have maxpoolsize and Minpoolsize,druid only retained Maxactive and Minidle, respectively, equivalent to Maxpoolsize and minpoolsize. 17. My application is configured with a JNDI data source, can I use Druiddatasource?

Druiddatasource supports JNDI configuration, specifically look here: Https://github.com/alibaba/druid/wiki/%E9%85%8D%E7%BD%AE_JNDI_Tomcat
The specific implementation of the class is this: Com.alibaba.druid.pool.DruidDataSourceFactory, you can read the code to deepen understanding. 18. My application has been using DBCP, which is written in the code, and how to replace it with Druid.

OK, Druid provides a way to completely smooth the migration dbcp. 1) Download from http://repo1.maven.org/maven2/com/alibaba/druid/druid-wrapper/Druid-wrapper-xxx.jar
2) Join Druid-xxx.jar
3 Remove Dbcp-xxx.jar from your web-inf/lib/
4 add configuration as needed, such as JVM startup parameter plus-ddruid.filters=stat, dynamically configure Druid filters

This usage makes it possible to use Druid in some applications that are not developed, such as the deployment of Druid,sonar in Sonar, a Web application developed using JRuby, written dead dbcp, which can only be replaced by this method.

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.