Tomcat的串連池配置(mysql)

來源:互聯網
上載者:User

 

tomcat下的配置,以前用的,參考一下:

  1. <!--for mysql database connection pool-->
  2. <Context path="/tomcattest" docBase="D:/eclipse/workspace/tomcattest" workDir="D:/eclipse/workspace/tomcattest/work/org/apache/jsp" debug="5" reloadable="true" crossContext="true" >  
  3. <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_DBTest_log." suffix=".txt" timestamp="true"/>
  4.           <Resource name="jdbc/test" auth="Container" type="javax.sql.DataSource"/> 
  5.           <ResourceParams name="jdbc/test">   
  6.                    <parameter>
  7.                                <name>factory</name>   
  8.                                <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>   
  9.                    </parameter>   
  10.                                 <!-- Class name for mm.mysql JDBC driver -->  
  11.                    <parameter>    
  12.                                 <name>driverClassName</name>      
  13.                                 <value>org.gjt.mm.mysql.Driver</value>   
  14.                    </parameter> 
  15.                                 <!-- The JDBC connection url for connecting to your MySQL dB.       
  16.                                      The autoReconnect=true argument to the url makes sure that the     
  17.                                      mm.mysql JDBC Driver will automatically reconnect if mysqld closed 
  18.                                      the connection.  mysqld by default closes idle connections after 8 hours.-->  
  19.                    <parameter>  
  20.                                 <name>url</name>
  21.                                 <value>jdbc:mysql://localhost:3306/test?autoReconnect=true</value>
  22.                    </parameter> 
  23.                                 <!-- MySQL dB username and password for dB connections  -->  
  24.                    <parameter>  
  25.                                 <name>username</name>   
  26.                                 <value>root</value>   
  27.                    </parameter>   
  28.                    <parameter>   
  29.                                 <name>password</name> 
  30.                                 <value>admin</value>   
  31.                    </parameter>
  32.                                  <!-- Maximum number of dB connections in pool. Make sure you 
  33.                                       configure your mysqld max_connections large enough to handle      
  34.                                       all of your db connections. Set to 0 for no limit.-->
  35.                    <parameter>    
  36.                                 <name>maxActive</name>   
  37.                                 <value>100</value>   
  38.                    </parameter>  
  39.                                  <!-- Maximum number of idle dB connections to retain in pool. 
  40.                                       Set to 0 for no limit. -->  
  41.                    <parameter>  
  42.                                 <name>maxIdle</name>
  43.                                 <value>30</value>
  44.                    </parameter>
  45.                                 <!-- Maximum time to wait for a dB connection to become available in ms,
  46.                                      in this example 10 seconds. An Exception is thrown if this timeout
  47.                                      is exceeded.  Set to -1 to wait indefinitely.-->   
  48.                    <parameter>     
  49.                        <name>maxWait</name>
  50.                        <value>10000</value>  
  51.                    </parameter>   
  52.         </ResourceParams>
  53. </Context>
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.