Original: http://www.mchange.com/projects/c3p0/#configuring_connection_testing
C3P0 provides a variety of methods for detecting failed connections, preventing programs from using invalid connections to complain. Connections fail for many reasons: JDBC driver actively shuts down long time connections, database or network reasons, insufficient resources, driver bugs, or other reasons.
First look at c3p0 this connection pool, the biggest advantage can automatically read the default configuration filedefault-config> //localhost:3306/swift_db default-config>There are general 4 main options and some other configurations in the configuration fileJust use the implementation class Combopooleddatasource in C3P0 to implement the Javax.sql.DateSource interface to create objectsprivat
Head schoolbag for HTTP request information, request head schoolbag
The head schoolbag contains important information related to HTTP requests, such as ip, host, url, and client, as shown in the following table:
Variable name
Value
Accept
Text/html, application/xhtml + xml, application/xml; q = 0.9, image/webp, */*; q = 0.8
Accept
PS How to make the figure of the head of funny Big head comic effect
Original
Final effect
1, with a rectangular selection tool box to the head, down to flatten a little, so that some of the characters will be more obvious, unless some face thin and long people, to both sides squeezed flat.
2, very key, with the great liquefaction tools to highlight t
Preface
When I first joined the work, my predecessors often taught me how to find a goal for myself and persistently strive to achieve your goal. No matter in terms of database and software design (I am engaged in software development), sticking to the effort will eventually have a good result. At the beginning, I didn't quite understand why they said this. I found out how important life goals are by looking at the materials and biographies related to life goals in various aspects.
Determ
Common Head labels and head labelsI. Label Classification
1.1 self-closing and label
Auto-closing: the auto-closing feature is enabled only when the start and end of the tag are absent:
1.2 active tag Closure
There are beginning and end, active closed, called active closed tags. Most of the tags we use are active closed tags.
Ii. Head tag 2.1 meta tag
result set if (rs! = Null) {try {rs. close () ;}catch (SQLException e) {}}// close the database operation object if (stmt! = Null) {try {stmt. close () ;}catch (SQLException e) {}}// close the database connection if (conn! = Null) {try {conn. close () ;}catch (SQLException e ){}}}
driverClassName=com.ibm.db2.jcc.DB2Driverurl=jdbc:db2://10.10.38.138:50000/malltestusername=db2inst1password=db2inst1initialSize=3maxActive=5maxIdle=3minIdle=1maxWait=30000
ComboPooledDataSource CPPS = new ComboPooled
1. Import the jar package:Hibernate-release-4.3.5.final/lib/optional/*.jar2. Add Configuration:hibernate.c3p0.max_size: Maximum number of connections to the database connection poolHibernate.c3p0.min_size: Minimum number of connections to the database connection poolHibernate.c3p0.timeout: The Connection object in the database connection pool should be destroyed when it has not been used for a long timeHibernate.c3p0.max_statements: Number of cached Statement objectsHibernate.c3p0.idle_test_peri
C3p0 connection pool configuration problems,
Correct configuration file
1
The whole process is to watch the video, but an error occurs in this line.
The correct format is "//"
DBCP and c3p0 are two database connection pools.Both connection pools are the connection pools recommended by hibernate.DBCP is a database connection pool that relies on the Jakarta commons-pool Object pool mechanism. The Tomcat data source uses DBCP.C3p0 is an open-source JDBC connection pool. It is released together with hibernate in the lib directory, including datasources objects for connection and statement pools that implement the jdbc3 and jdbc
connection pool (not the C3P0 connection pool used here) to get the database connection, so the connection pool must be constructed first.
Here are four actions: Add and delete and check
@Test public
Void Add () {
//because JdbcTemplate is dependent on the database connection pool, the connection pool is constructed first
Drivermanagerdatasource Drivermanagerdatasource=new Drivermanagerdatasource ();
Drivermanagerdatas
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.