Recently, other projects often fail to get links, and I am curious to play with them. The plug-in used is c3p0 + spring + ibatis, of course, the transaction management configuration is as follows:
1
The configuration above is a little long. Let's take a few important instructions:
datasource.minPoolSize=30datasource.maxPoolSize=80datasource.initialPoolSize=40datasource.maxIdleTime=60datasource.acquireIncrement=5datasource.idleConnectionTestPeriod=60d
What is Cndi?Is the Java naming and directory interface, which is a standard Java naming system interface provided by Sun Corporation.Not good to understand? Simply put, he is a resource, a resource placed in Tomcat, today we put the database connection pool into Tomcat, of course, you can also put something else, such as been.ok! startFirst we create a new Web project:New project called: Jndi_demoThen, under the Tomcat directory: F:\apache-tomcat-5.5.25\conf\Catalina\localhost, create a resourc
Some colleagues recommended bonecp. The results of searching benchmark on the Internet were amazing. Recently, I used the connection pool to change it to bonecp. However, after my own use and testing, I switched back to c3p0 for two reasons:
1. bonecp is less stable than c3p0 in high concurrency, and other identical conditions (web layer jersey, data layer PostgreSQL ), when bonecp is used, the fluctuation
In everyone's development and learning which should be used frequently to database connection and use, just connectIn many ways, such as using the most simple JDBC, and more practical thanA more complex point is the database connection pool. Of course there are connections using DBCP, and various partiesMethod has the advantages and disadvantages of various methods, it is necessary for us to analyze the details of, for example, if a project is not very large, and the nature of the hardware machi
What 1.C3P0 is.
C3P0 is a library. It extends the traditional JDBC database connection pool and supports standard extensions for JDBC3 specifications and JDBC2.2. Why use C3P0.
First, C3P0 is a JDBC database connection pool. So why use a database connection pool? Because database connectivity is a critical, limited,
database connections are often created to be placed in the connection pool for backup. The initialization of the connection is now complete. For business request processing, direct utilization of existing available connections avoids the time overhead of database connection initialization and deallocation, thus reducing system response time (3) New resource allocation means for multiple applications sharing the same database system, the application layer through the database connection pool con
Label:Using the Listener step 1. Defining the Listener implementation class 2. Configuring (or using annotation) in Web. xml Create a jar package to add a database connection pool using the C3p0 method 1.c3p0-0.9.5.jar 2.c3p0-oracle-thin-extras-0.9.5.jar 3.mchange-commons-java-0.2.9.jar 1 PackageCn.sdut.lah.listener;2
3 Importjava.sql.Connection;4 ImportJavax.
Tomcat configuration connects to the c3p0 connection pool,
1. Configure the JNDI resource for Tomcat
JNDI (Java Naming and Directory Interface), Java Naming and Directory Interface.
The role of JNDI is to configure resources on the server and then obtain the configured resources in a unified manner.
The resource we want to configure here is of course the connection pool, so that the project can obtain the connection pool object in a unified way.
1. Im
disadvantages of various methods. We have analyzed the advantages and disadvantages according to the actual situation.
For example, if a project is not a large project, and the hardware machines used
If it is not very good, it is estimated that there is no need to use the database connection pool. After all, the connection
The pool usually manages connections, which greatly occupies the running performance and efficiency of the machine.
(C3P0 is
Which of the following is the high efficiency of proxool and c3p0? The benevolent sees benevolence, the wise sees wisdom, I did not dare to say, it seems that c3p0 has a higher reputation, so it adopted c3p0 ..
As a result, this guy nested the servlet in the web page and then the servlet to execute this command, why not? Finally, I wrote another class to execute
First create the C3P0 data source class PackageCom.example.demo.config;ImportJavax.sql.DataSource;ImportOrg.mybatis.spring.SqlSessionFactoryBean;ImportOrg.springframework.beans.factory.annotation.Qualifier;ImportOrg.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;Importorg.springframework.boot.context.properties.ConfigurationProperties;ImportOrg.springframework.context.annotation.Bean;Importorg.springframework.context.annotation.Configuratio
Project Address: Https://gitee.com/zhangjunqing/spring-boot/tree/master/springboot-mybatis-noticeI in the C3P0 data source integration process, the need to configure a variety of parameters, but according to the network of various data configuration found to test the wrong1 Scene reproduction The configuration of many data sources on the Web is configured in a similar manner as follows:2 Trace Debug View the value of the data source Acquireincrement i
First, create a file
Create a file named "C3p0-config.xml" in the SRC directory, which reads:
Second, create C3p0utils
/** * @author CSDN_LQR * @TODO C3P0 Tool Class (Database connection Pooling tool) for managing multiple database connection objects.
* Unlike DBCP, C3P0 does not have to manually load the configuration file, just put the configuration file i
Tags: ges PSU database Connection Timeout DCL System Note Blog HelpAs I've said before, DBCP can be used for database connection pooling management. Another technology c3p0 can also be used for database connection pool management, where spring and other frameworks are based on C3P0 technology for database connection pool management. Before using the C3p0-0.9.5.2.
What does a database connection pool do?Learned the computer network know that in an internal LAN, most of the use of private addresses, in order to deal with the outside, must have a corresponding legal external address corresponds. However the number of internal users is huge, one machine an external IP is unrealistic. So there's a concept called connection pooling. Because not every user wants to surf the internet at the same time, when a user needs to surf the Internet, he can get an externa
C3P0: An open-source JDBC Connection pool that implements data source and Jndi bindings, and supports standard extensions for JDBC3 specifications and JDBC2. The open source project that uses it now has hibernate,spring etc.
By default (that is, no connection pooling is configured), Hibernate uses a built-in connection pool. However, this connection pool performance is not good, so the official is only recommended in the development environment to 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.