Spring configuration tomcat JDBC Pool database connection pool

Source: Internet
Author: User
Tags sqlite

<bean id= "Sqlitedatasource" class= "Org.apache.tomcat.jdbc.pool.DataSource" destroy-method= "Close" ><!-- <bean class= "Org.apache.tomcat.jdbc.pool.PoolProperties" >--><!--database connection pool configuration--><!--user name, password-- <property name= "username" value= "root"/><property name= "password" value= "password"/><!-- Driver's full valid Java class name, establish the URL of the connection--><!--<property name= "Driverclassname" value= "Com.mysql.jdbc.Driver"/>< Property name= "url" value= "Jdbc:mysql://localhost:3306/mysql"/>--><property name= "Driverclassname" value= "Org.sqlite.JDBC"/><property name= "url" value= "jdbc:sqlite:d:test.db"/><!--(int) Maximum idle connection: The maximum number of connections allowed to remain idle in the connection pool, excess idle connections will be released, if set to negative indicates no limit if enabled, limit connections are checked periodically, and if idle time exceeds minevictableidletimemillis, the connection is released ( Reference testwhileidle)--><property name= "Maxidle" value= "/><!--(int) Minimum idle connection: the minimum number of connections allowed to remain idle in the connection pool, Below this number will create a new connection, if set to 0 is not created, if the connection validation failure will reduce this value, the default is the same as InitialSize--><property name= "Minidle" value= "/><"!--(int) The maximum active connection: The number of maximum active connections that the connection pool can allocate at the same time, and if set to non-positive, means unrestricted--><property name= "maxactive" value= "/><!--" (int Maximum wait time: when there is no available connection, the maximum time (in milliseconds) that the connection pool waits for the connection to be returned, an exception is thrown when the time is exceeded, and if set to 1 means infinite wait, default 30000 (30 seconds)--><property name= "Maxwait" Value= "10000"/><!--(int) Initializes the connection: the number of initial connections created when the connection pool starts--><property name= "initialsize" value= "/><"!-- (Boolean) flag whether to remove compromised connections if they exceed the removeabandonedtimout limit. If set to True, the connection is considered to be compromised and can be deleted if the idle time exceeds removeabandonedtimeout. Set to True to repair the database connection for poorly written programs that do not have the connection closed. Refer to logabandoned--><property name= "removeabandoned" value= "true"/><!--(int) The time-out value of the leaked connection can be deleted, The unit seconds should be set to the maximum time the query execution in the app--><property name= "Removeabandonedtimeout" value= "" "/><!--Verify that the connection is valid, (String) SQL Query, which verifies the connection taken out of the connection pool before the connection is returned to the caller. If specified, the query must be a SQL SELECT and must return at least one row of record queries that do not have to return records, but will not be able to throw SQL exceptions--><property name= "Validationquery" value= "SELECT 1 The/><!--(long) avoids over-validation and guarantees that the validation does not exceed this frequency-in milliseconds. If a connection should be verified, but the last validation did not reach the specified interval, it will not be validated again. 30000 (30 seconds)--><property Name= "validAtioninterval the default Auto-commit state of connections created by the "value=" 30000 "/><!--(Boolean) connection pool, driver defaults--><property name= "Defaultautocommit" value= "true"/><!--validation failure, whether to discard the connection from the pool--><property name= "Testwhileidle" value= "true"/ ><!--Disconnect the idle time over minevictableidletimemillis milliseconds until the number of connections in the connection pool is minidle (milliseconds, 30 minutes)--><property name= " Timebetweenevictionrunsmillis "value=" 1200000 "/><!--connection pool can be idle for a period of time (MS, 5 minutes)--><property name=" Minevictableidletimemillis "value=" 1800000 "/><!--Check the number of connections at run time for each idle connection collector thread (if any)--><property name=" Numtestsperevictionrun "value=" 5 "/></bean>

Spring configuration tomcat JDBC Pool database connection pool

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.