Tags: style blog http ar color SP data on divProject is b/s mode, placed on a Linux server, Tomcat and oracle11g on a server, Tomcat read database using C3P0 connection pool, has been relatively stable, so there is no pipe. Later, the Tomcat was placed under one win2008 and the database was placed under another win2008. Run for more than half a month, during the regular Report database connection error, but refresh the next page is also good. Because
Perac =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP) (HOST = 131.197.17.137) (PORT = 1521))(ADDRESS = (PROTOCOL = TCP) (HOST = 131.197.17.138) (PORT = 1521))(load_balance = yes)(FAILOVER = ON)(Connect_data =(SERVER = dedicated)(service_name = PE)(Failover_mode =(TYPE = SELECT)(METHOD = BASIC)(retries=180)(delay=5)))) It is very simple for me to configure this string connection in the program. Just put this string above the URL tag that previously placed only one URL connection. The previous configur
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.
Database connection pool, once configured in the project is generally rarely changed, so many people did not carefully study (sometimes even the operation of the person responsible for configuration), in fact, this knowledge point is still very important, so I summed up here to share, need to use the time to take out to see it. Here we introduce the configuration of C3P0.and other methods to improve the performance of the connection test. Default:fals
First step in Hibernate.cfg.xml configurationfalseAnd then!!!!!!! The exception encountered ======Configuration does not use a purely JDBC connection and is also configured in the Hibernate.cfg.xml falseThe third guide package, D:\HIBERNATE-RELEASE-4.2.21.FINAL\LIB\OPTIONAL\C3P0, the following packages are all directed.Hibernate Configuration c3p0 Connection pool
Recently, the project used the data layer combination of hibernate3.0 C3PO MySQL, and the development and deployment were smooth. However, every morning when accessing the application, the cocould not open hibernate session for transaction exception was thrown, caused by: COM. mySQL. JDBC. communicationsexception: communications link failure due to underlying exception, but after several accesses, it returns to normal. The datasource configuration is as follows:
According to the problem pheno
C3p0The performance of the connection pool is better than that of DBCP. hibernate recommends this connection pool. The c3p0 connection pool can not only automatically clear connections that are no longer in use, but also automatically clear statement and resultset.
Import Java. beans. propertyvetoexception; import Java. SQL. connection; import Java. SQL. resultset; import Java. SQL. sqlexception; import Java. SQL. statement; import COM. mchange. v2.
Oracle 10G tablespace movement, all applicable routines of the TNS listener cannot establish a new connection, service_died 12537, c3p0 connection pool parameters,
One Oracle O M experience while learning and working, step by step.
A few days ago, after deleting junk data tables and clearing the rollback tablespace, we rebuilt the index again, and felt that oracle's performance was really amazing. The system started to run quickly again.
After the cu
Many of the configurations of c3p0 in spring + hibernate on the Internet are almost not completely correct. The following is the correct configuration according to the documents of c3p0 that have been tested many times:
Class = "org. springframework. Orm. hibernate3.localsessionfactorybean">
Org. hibernate. dialect. oracle9dialect
"); datasource.setuser ("root"); Datasource.setpassword ("root");
String sql= "INSERT into Sw_user (Username,password) VALUES (?,?)";
int count=jdbctemplate.update (SQL, "Bullet", "War hero Song");
if (count==1) {return
true;
}
return false;
}
}
The object in Userdao to use JdbcTemplate, which is also injected through the configuration file XML, requires Setjdbctemplate () to match
The JdbcTemplate object also needs to inject datasource object
A problem has recently occurred in a project:
The system uses the SPRING+C3P0 to manage the connection pool for the database, with a total of 4 data sources in the project. When you start a project, if one or more of the data sources are not connected, the background attempts to connect indefinitely, causing the entire project to fail to start.
In fact, the result we want is that if a data source cannot be connected, skip the connection to the data s
Is the MAVEN configuration file: Pom.xml's code content:
Application-beans.xml's code content:
Dao class:
Package DAO;
Import Org.springframework.jdbc.core.support.JdbcDaoSupport;
public class Dao extends Jdbcdaosupport {
}
Spring JDBC reference URL: Https://www.yiibai.com/springjdbc/preparedstatementsetter.html#article-start
Druid:maven Pom.xml Join
C3p0:maven Pom.xml Join
Druid.xml content is as follows:
Property Preferredtestquery will be ignored. You cannot do anything on this test sheet, it will be for C3P0 testing only
Use. Default:null-->
Reserved and continue trying to get the connection the next time you call Getconnection (). If set to true, then try to
When a connection failure is obtained, the data source declares that it has been fractured and closed permanently. Default:false-->
SQLException, if set to 0, waits indefinitely. Unit milli
Tags: spring-use configuration file to complete JdbcTemplate operation database-c3p0First, create a spring projectProject Name: spring101302Ii. adding a jar package to the project1. Create a Lib directory in your project/lib2. Add spring support under the Lib directoryCommons-logging.jarJunit-4.10.jarLog4j.jarMysql-connector-java-5.1.18-bin.jarSpring-beans-3.2.0.release.jarSpring-context-3.2.0.release.jarSpring-core-3.2.0.release.jarSpring-expression-3.2.0.release.jarSpring-jdbc-3.2.0.release.ja
This article provides an C3P0 connection to the DBCP connection pool when you connect to the MySQL database. No requests for self-disconnecting solutions within 8 hours. Let's start by describing the issues I encountered in the project (C3P0 connection pool), followed by a workaround for using the DBCP connection pool.Basic Problem Solving Project environment:Java Web project Framework for spring MVC+JPA, u
Use of Queryrunner in 1:dbutils:
The API for SQL statement operations is provided in 1.1:queryrunner.
1.2: There are three main methods:
1.2.1:query (): Used to execute select (query);
1.2.2:update (): Used to perform insert (insert)/update (update)/delete (delete);
1.2.3:batch (): Batch processing;
Combined use of 2:c3p0 and Queryrunner:
2.1: First guide the package, as shown below the package;
C3p0-0.9.1.
Tags: c3p0 database connection PoolC3P0 Database Connection pool: We will use this database connection pool after development, very convenient. Only one configuration file is required, c3p0 default is to find the C3p0-config.xml file in the class bytecode file. Steps to use: 1. Import the appropriate jar package to 2. Then use in class Case 1: Package com.itheim
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.