Druid Use and Configuration

Source: Internet
Author: User

Druid Data Source Configuration

<BeanID= "DataSource"class= "Com.alibaba.druid.pool.DruidDataSource"Init-method= "Init"Destroy-method= "Close">              < Propertyname= "url"value= "${ds1.url}" />              < Propertyname= "username"value= "${ds1.username}" />              < Propertyname= "Password"value= "${ds1.password}" />                  <!--Configure monitoring Statistics interception filters, remove post-monitoring interface SQL cannot be counted -            < Propertyname= "Filters"value= "Stat" />              <!--Configure initialization size, minimum, maximum -            < Propertyname= "Maxactive"value= " the" />               < Propertyname= "InitialSize"value= "1" />              < Propertyname= "Minidle"value= "1" />              <!--Configure the time to get the connection wait timeout -            < Propertyname= "Maxwait"value= "60000" />              <!--How often the configuration interval is detected to detect idle connections that need to be closed, in milliseconds -            < Propertyname= "Timebetweenevictionrunsmillis"value= " the" />                  <!--configures the minimum lifetime of a connection in a pool, in milliseconds -            < Propertyname= "Minevictableidletimemillis"value= "300000" />              < Propertyname= "Validationquery"value= "Select ' X '" />              < Propertyname= "Testwhileidle"value= "true" />              < Propertyname= "Testonborrow"value= "false" />              < Propertyname= "Testonreturn"value= "false" />              <!--open Pscache, and specify the size of Pscache on each connection -            < Propertyname= "Poolpreparedstatements"value= "true" />            < Propertyname= "Maxpoolpreparedstatementperconnectionsize"value= " the" />          </Bean>

This data source is already in use at this time

To view .../proname/druid/add servlet in Web. xml

<servlet>    <Servlet-name>Druidstatview</Servlet-name>    <Servlet-class>Com.alibaba.druid.support.http.StatViewServlet</Servlet-class></servlet><servlet-mapping>    <Servlet-name>Druidstatview</Servlet-name>    <Url-pattern>/druid/*</Url-pattern></servlet-mapping>

Now you have access to Druid management, where you can configure filtering, like this:

<servlet>    <Servlet-name>Druidstatview</Servlet-name>    <Servlet-class>Com.alibaba.druid.support.http.StatViewServlet</Servlet-class>    <Init-param>        <Param-name>Allow</Param-name>        <Param-value></Param-value>    </Init-param>    <Init-param>        <Param-name>Deny</Param-name>        <Param-value>192.168.146.1</Param-value>    </Init-param>    <Init-param>        <Param-name>Principalsessionname</Param-name>        <Param-value>Session.user</Param-value>    </Init-param>    <Init-param>        <Param-name>Principalcookiename</Param-name>        <Param-value>Cookies.user</Param-value>    </Init-param></servlet>

But now there are some tags in the druid, no data: Add under Web. xml:

<Filter>    <Filter-name>Druidwebstatfilter</Filter-name>    <Filter-class>Com.alibaba.druid.support.http.WebStatFilter</Filter-class>    <Init-param>        <Param-name>Exclusions</Param-name>        <Param-value>*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*</Param-value>    </Init-param></Filter><filter-mapping>    <Filter-name>Druidwebstatfilter</Filter-name>    <Url-pattern>/*</Url-pattern></filter-mapping>

This will monitor all requests;

The first blog post is a start

Welcome to correct me, I small white, mouth under mercy,/embrace/embrace/embrace

Druid Use and 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.