DBCP database Connection Pool connection problem occurs when connecting to MySQL database

Source: Internet
Author: User

In the deployment of the project to find two problems, the first problem is not too easy to find, because I deploy the time is not a problem, but the product's colleagues in the run process is always a connetexception abnormal look at a long time did not find what problems to check the internet for a bit It's a msql connection. The second problem is that the database on your side is automatically disconnected for a period of time. Check the data is the DBCP connection to MySQL when the problem is actually two problems is a problem I configured a bit of these days did not report such a mistake! Sort of solved it!

 <bean id= "DataSource"         class= " Org.apache.commons.dbcp.BasicDataSource "        destroy-method=" Close " >        <property name= "DriverClassName"  value= "${ Driverclass} " />        <property name=" url "  Value= "${jdbcurl}"  />        <property name= "username"  value= "${user}"  />        <property name= " Password " value=" ${password} " />        <property  name= "InitialSize"  value= "Max"/>        <property  name= "maxactive"  value= "/>         <!-- removeabandoned:  whether to automatically reclaim timeout connections-->   &nbSp;        <property name= "removeabandoned"   value= " True "/>         <!--removeabandonedtimeout:  Time-out ( in seconds)-->            <property name= " Removeabandonedtimeout " value="/>        <!-- 1000  * 60 * 30   connections remain idle in the pool without being idle connection to the collector thread-->           <property name= "Minevictableidletimemillis"  value= "/>  "         <property name= "Validationquery"  value= "Select  now ()  from dual "/>         <!--          <property name= "AutoReConnect"  value= "true"/>      &nBsp;  <property name= "removeabandoned"  value= "true"/>         <property name= "Removeabandonedtimeout"  value= "/>   "      <property name= "logabandoned"  value= "true"/>         -->    </bean>


Related Article

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.