Java SQL driver driver that provides a connection pooling package for other types of drivers that you choose. Can be ported to existing code very simply. Fully configurable. Fast, mature and robust. You can transparently increase the connection pooling capability for your existing JDBC driver.Database connectivity is
One night on the eve of 2014 618 the SQL execution times for a system was wrong:
Will throw more than 800 of the following errors
Caused by:java.sql.sqlexception:ora-01013: The user requested to cancel the current operation at
Oracle.jdbc.driver.DatabaseError.throwSqlException ( databaseerror.java:112) at
oracle.jdbc.driver.T4CTTIoer.processError (t4cttioer.java:331)
at Oracle.jdbc.driver.T4CTTIoer.processError (t4cttioer.java:288) at
oracle.jdbc.driver.T4C8Oall.receive ( t4c8oall.java:745) at
Label:When using DBCP, add destroy-method= "close" to destroy the method is OK, but with the spring JDBC will be an error message that the Close method is not found this is why? DBCP DBCP (database connection pool), DB connection pool. is a
1. Importing the JAR PackageC3p0-0.9.1.jarmchange-commons-java-0.2.3.4(Note: The jar package is a C3P0 database connection pool of auxiliary packages, no this package system will be reported when the boot ClassNotFoundException, This is the c3p0-0.9.2 version after the separation of the package, 0.9.1 when a package will be done)2. Get the connectionC3P0 is imple
1 Druid Introduction
Druid is a project on Alibaba's Open source platform, which consists of a database connection pool, a plug-in framework, and a SQL parser. The main purpose of this project is to extend some of the limitations of JDBC, allowing programmers to implement specific requirements such as requesting credentials for key services, statistical SQL info
conquer.The first is to understand the configuration of the connection pool (above)The second is to know the wait_timeout settings in MySQLTwo-point combined talent determines the proper configuration of the connection pool in the project.Assuming that Wait_timeout is set to a very large value, such as a year, the con
Tags: syn exce into for stat jdb NEC size andConnection pool:create many Connection objects in advance, and put the Connection into the cache (list). The client would get the connection from the cache, and return the Connectio to the cache after using it. This is the could improve the access effeciency of data base. Simulate the
Tags: ble currently technology height IMG show ima share connect1. Display As, open log can be seen: Variable Name must not being empty for ELEMENT:JDBC Connection configuration, that is, JDBC Connection Configuration connection Variable name cannot be empty in the settings.2. Set the variable Name for created
Java database connection pool configuration methods (take MySQL database as an example), database connection mysqlSeveral configuration methods for Java Database Connection Pool (taking
Package com.action;
Import java.sql.Connection;
Import Java.sql.ResultSet;
Import java.sql.SQLException;
Import java.sql.Statement;
Import Org.apache.tomcat.jdbc.pool.DataSource;
Import org.apache.tomcat.jdbc.pool.PoolProperties; /* * Tomcat's own JDBC Pool connection pooling technology is said to be more efficient and will be used today to sort out the following
If you are only interested in MySQL can copy this essay, if you want to configure other database types of connection pool, you can also make simple modification parameters to use.
1. Install Tomcat
Refer to the Tomcat for Window Installation Wizard, the basic direct installation, note: Installation will be prompted to enter the admin username and password, this is the user name and password will be used in
Application jar:Note the JDBC configuration driver and URL methods:Class.forName ("Com.microsoft.jdbc.sqlserver.SQLServerDriver"); String url= "Jdbc:microsoft:sqlserver://localhost:1433;databasename=test";If you connect using C3P0, the configuration in properties is:Jdbcdriver = COM.MICROSOFT.SQLSERVER.JDBC.SQLSERVERDRIVERJDBCURL = Jdbc:sqlserver://localhost:1433;databasename= TestAt this point, the plug-in configuration mode in Jfinal:C3p0plugin c3p0
After one night, I checked n more articles, tried n more complex methods, and finally found a super simple method in an article, it's really just a waste of shoes! You do not need to follow the management method, as long as you follow the methods below, you can successfully configure the Tomcat connection pool.
Set the tomcat/CONF/context. xml file to the following content.
Maxactive = "100" maxidle =
Edit context. XML in the project. If no, create context. xml.
1. Context. xml
Characterencoding = UTF-8, set the database Encoding
2. Connection Pool case
Package JDBC. util;
config.setmaximumpoolsize (Maximum);
ds = new Hikaridatasource (config);
}
/** * Destroy Connection Pool */public void shutdown () {ds.shutdown ();
/** * Get the link from the connection pool * @return */public Connection getconnection () {try {return ds.getconnec
in the connection pool to prevent endless connections to the database. More importantly, we can monitor the number of database connections through the connection pool management mechanism? Usage, for system development? Provides the basis for testing and performance adjustment.
2.
Problem:This case requires the use of Apach DBCP to connect the data pool refactoring class dbutility to the Connectionsource class, refactoring the case "implement Dbutility", providing access to the connection, closing the function " The Empdao class in which you use Connectionsource to obtain a connection.Scheme:When accessing a database directly using JDBC
interface implemented by the invocation handler of a proxy instance. each proxy instance has an associated invocation handler. when a method is invoked on a proxy instance, the method invocation is encoded and dispatched to the invoke method of its invocation handler.
There are many proxy descriptions in Sun's API documentation, which are not listed here. Through the description of the interface invocationhandler, we can see that when you call a proxy instance method, the i
establish a connection every time, wasting resources and waiting time, the connection is done in the connection pool, when needed to obtain//c3p0 connection pooling can automatically read related properties through profile c3p0-config.xml files//C3P0
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.