Add database monitoring to your app (with Druid)

Source: Internet
Author: User

1, use DataSource, fill in the corresponding URL username and password can be!

<bean id= "DataSource" class= "Com.alibaba.druid.pool.DruidDataSource" init-method= "Init" destroy-method= "Close" > <!--Basic property URL, user, password-<property name= "url" value= "Your url"/> <property nam E= "username" value= "your username"/> <property name= "password" value= "Your password"/> <!--configuration initialization large       Small, minimum, maximum--<property name= "InitialSize" value= "1"/> <property name= "Minidle" value= "1"/> <property name= "maxactive" value= "/> <!--configuration Get connection Wait timeout time--<property name=" maxwait "value=" 60000 "/> <!--configuration interval to detect the idle connection that needs to be closed, in milliseconds--and <property name=" Timebetweenevictionrunsmillis "va Lue= "60000"/> <!--Configure the minimum lifetime of a connection in the pool in milliseconds-and <property name= "Minevictableidletimemillis" value= "30 0000 "/> <property name=" validationquery "value=" select ' X ' "/> <property name=" Testwhileidle "value = "true"/> <property nAme= "Testonborrow" value= "false"/> <property name= "Testonreturn" value= "false"/> <!--if Oracle is used, the Poolpreparedstatements configured to True,mysql can be configured to False. A database with more sub-tables is recommended to be configured as false. -<!--open Pscache, and specify the size of Pscache on each connection-<property name= "poolpreparedstatements" value= "true"/&gt      ; <property name= "maxpoolpreparedstatementperconnectionsize" value= "/> <!--Configuration Monitoring statistics interception filters--& Lt;property name= "Filters" value= "stat"/> </bean>
2. Add 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>
3, because I use EXTJS development background, the monitoring page embedded in the ExtJS code as follows:
Ext.define (' Kl.view.DruidMonitor ', {    extend: ' Ext.panel.Panel ',    alias: ' Widget.druidmonitor ',    height: ,    HTML: ' <iframe src=\ '. /.. /druid\ ' height=\ ' 100%\ ' width=\ ' 100%\ ' > </iframe> ',    width:400,    title: ' Database Monitoring ',    Initcomponent:function () {        var me = this;        Me.callparent (arguments);    }});
Last sticker:

Add database monitoring to your app (with Druid)

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.