restart, cannot be reconnect, but can be resolved through configuration), Hibernate in action recommends the use of C3P0 and Proxool. There are many other commercial products, but performance and stability overall performance is not as good as these open source database connection pool. From the online search situation, but also dbcp, C3P0, proxool the use of more extensive. However, it is difficult to get
* Function: Establish connection pool
* */
private static DataSource localhost () {
DataSource Ds=null;
In HashMap, get value by getting (), insert value by put (),
ContainsKey () is used to verify that the object already exists
Hashmapif (Cachedds.containskey ("DS"))//Remove the idle state of the database connection
{
/* A number of database connection
are available. The configuration of this connection pool is described in the attachment compression package: Dbcp.xmlUsage Evaluation: In the specific project application, it is found that the stability of the continuous operation of this connection pool is still possible, but the speed is slightly slower, the stabili
Step 1: Write javabean Copy codeThe Code is as follows:Package withouttears. jdbc. db;Import java. util. HashMap;Import java. SQL .*;// JNDI has two core interfaces: Context and DirContext,// Context contains basic name operations, while DirContext extends these operations to directory services.Import javax. naming. Context;Import javax. naming. InitialContext;// The database resource connection Factory is a javax. SQL. DataSource object,// It can cre
information into a separate table more convenient query. Longitudinal cutting:is called a row cutting. When it comes to big data, the number of columns directly affects the access effect.Instance segmentation:is to abstract the common business parts and store them in separate databases. For example, account database (store user information), log database (storage monitoring data) ... Instance Physical Storage Segmentation:When big data is placed
Yesterday, I was asked the following question: this often happens on their SQL Server servers. The number of processes at a certain point in time can reach hundreds at once. The possibility of being attacked was ruled out. I helped them analyze the possibility that the connection pool was improperly used in the application. Their programs are jsp and run through the tomcat server.
I have also introduced th
Yesterday, I was asked the following question: this often happens on their SQL Server servers. The number of processes at a certain point in time can reach hundreds at once. The possibility of being attacked is ruled out. I can help them analyze the possibility of application.ProgramWhich is caused by improper use of the connection pool. Their programs are JSP and run through the Tomcat server.
I have also
Occasional opportunity to explain Druid connection pool, Up-and-comer, but the evaluation is good, in addition, because it is Ali Bao used so still pretty optimistic.
Druid Set Connection pool, monitor the integration of the current project needs, the project is the SSH structure, before the use of C3P0, now a
spring.datasource.timebetweenevictionrunsmillis:60000# to configure the minimum time for a connection to survive in the pool, Units are in milliseconds Spring.datasource.minevictableidletimemillis:300000spring.datasource.validationquery:select 1 from DUALspring.datasource.testWhileIdle:truespring.datasource.testOnBorrow:falsespring.datasource.testOnReturn: false# opens Pscache, and specifies the size of th
Druid is a database connection pool first, but it is not just a database connection pool. It also contains a proxydriver, a series of built-in JDBC component libraries, and an SQL parser.
Maven Configuration
Add the following configuration section in the Pom. xml file --
1
Spring data source configuration
Add th
Because the link pool provided by Hibernate is inefficient and has many bugs, It is not officially recommended. We recommend using a connection pool such as proxool to replace hibernate.
This configuration method is used by spring to take over the proxool connection pool, wi
Official site: http://proxool.sourceforge.net/current version: proxool-0.9.0RC21. Download proxool address: http://proxool.sourceforge.net2XX uncompress proxool-0.9.0rc2.zip, copy lib/proxool-0.9.0RC2.jar to Web-info/lib copy JDBC driver to Web-info/lib3. Create a file under Web-Info: proxool. xml4. Add the following in Web. xml:5. Call the database connection Code :Class. forname ("org. logicalcobwebs. proxool. proxooldriver ");
alias in proxool. xml. This is not needed elsewhere. It can also be integrated with hibernate. Integration with spring is relatively simple. The above configuration method is used. The configuration is complete, which is clear and simple. If you want to view the monitoring status, you can view the monitoring status at http: // www. ××××. com/admin. If you want to test locally, change the path. The above de
First, the normal steps to configure the Proxool connection pool, in the web.xml configuration of automatic monitoring, to do a simple test to ensure that the connection pool to work properly. The Proxool.xml configuration is as follows:
1.proxool.xml
Anything outside the "P
In WIN7 X64 system or other Windows X64 system IIS, you cannot connect to access data by using Jet.Common Error Tips:
ADODB. Connection error ' 800a0e7a ', provider not found. The program may not be installed correctly.OrMicrosoft OLE DB Provider for ODBC Drivers error ' 80004005 '[Microsoft] [ODBC Driver Manager] did not find a data source name and no default driver specifiedThe reason is that there is no
1. Create the proxool. xml file under the WEB-INF directory in the project (also in other directories, as long as you can find it) with the content:
2. Add the configured data source to Web. XML in the project, and add the following content under Web-app:
If you do not use the management and monitoring tool, you do not need to configure it.
3. test:
// Obtain the public void getconnection () throws exception {If (conn = NULL) {// class of the p
Recently using the Druid Connection pool, and also configuring the Web and spring related monitoring, detected that the select * from tables param like #{param1} "%" statement was intercepted. Take a note.There are two ways to resolve this:One, select * from tables param like concat (${param1}, "%").Second, when the parameters of the dynamic splicing param1=param
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.