Original address :http://www.cnblogs.com/jfzhu/p/3705703.html

Reprint please indicate the source

Establishing a physical connection to the database is a time-consuming task , So whether it's ADO.NET still J2EE Both provide a connection pool technology .

A pool is actually a list . stay ADO.NET in , There is one Connection Manager, It's for every connection string All manage a list of available connections , This list is Connection Pool.

When the first database connection is initialized ,connection manager Will create a Connection Pool Group. When the first connection is opened , To create the first connection pool. A connection is being used , It will start from connection pool Remove ; If used up ( By close or dispose), Will return to connection pool In the middle , Waiting for the next connection request to use , So we need to be clear about a concept ,close connection It's just closing the logical connection , But it doesn't close the physical connection .

stay ADO.NET in , By default , A connection returns to connection pool in , There will be 4 To 8 Minutes of free time , Beyond that time , Will close the physical connection . If your program has a long idle time , You should make sure that at least one database connection is available , Can be set by Min Pool Size by 1 To achieve .

Also decide whether a connection uses the same connection string The decisive parameters of are as follows :

  • Connection Timeout
  • Min Pool Size
  • Max Pool Size
  • Pooling
  • Connection Reset
  • Load Balancing Timeout(Connection Lifetime)
  • Enlist

whenever Connection Manager When a new database connection request is received , It will go through the following process :

Last Entity Framework I'll manage it for you connection pool, So don't worry about the efficiency of the database connection .

Connection pool technology Connection Pooling More articles about

  1. Connection pool (Connection Pool) technology

    explain : Connection pool (Connection Pool) The core idea of technology is : Connection reuse , Through the establishment of a database connection pool and a set of connection usage . Distribute . Management strategy , So that the connections in the connection pool can be efficiently . Secure reuse , Avoid frequent database connection ...

  2. use DBCP Connection pooling technology manages connections

    DBCP The use of step 1 : Guide pack , Use third party props , The corresponding jar package . Generally, you need to import two jar package : -commons-dbcp-1.x.jar package -commons-pool-1.x.x.jar package ...

  3. Open source connection pooling Technology DBCP and C3P0

    summary : Sun The company agreed that : If it's connection pooling Technology , You need to implement an interface ! javax.sql.DataSource;   relevant jar Package and information download 1.1  DBCP Connection pool : l  DBCP yes Apache soft ...

  4. JDBC example --JDBC Connection pooling technology , Connection pool is no longer strange to us

    One . Why do we use connection pooling Technology ? The previous method of establishing and closing database connection has some defects . The traditional database access mode of the command cabin : One database access corresponds to one physical connection , Open the database every time . Close the physical connection , The performance of the system is seriously damaged . Explain ...

  5. 2017.10.21 Java Data source and connection pool technology in

    1. Data source technology is to establish a certain number of database connections in advance , And save these connections in the connection pool , There is a connection pool responsible for the connection management of these databases , When accessing a database , You just need to get the database connection with idle state from the connection pool : At the end of the program's access to the database , Interpretation of the ...

  6. Walk into JavaWeb Technology world 3:JDBC Evolution and connection pooling technology of

    Walk into JavaWeb Technology world 3:JDBC Evolution and connection pooling technology of Reprint official account [ Code farmer turn over ] Network access With Oracle, Sybase, SQL Server ,DB2,  Mysql And others continue to live in the database ...

  7. Thread pool - Connection pool -JDBC example -JDBC Connection pool technology

    Thread pool and connection pool    The principle of thread pooling :     Let's see what happened to Cheng Chi ? The principle of thread pooling is simple , Similar to the concept of buffer in the operating system , It goes like this : Start with a number of threads , And put the threads to sleep , Be a guest ...

  8. Decrypt httpclient,dbcp,jedis,c3p0,druid,okhttp All in use connection pool technology

    Recently, I planted a heel on the connection pool ( See here. ), I'm very interested in pool technology , These days, I have summarized the pool technology used in many scenarios : Pool concept pool, Pool , But in English , Another explanation is an organizati ...

  9. Mybatis Connection pooling technology for

    We're in the front WEB Similar connection pooling techniques have been learned in the course , And in the Mybatis There is also connection pooling technology in , But it's self-contained Our connection pooling Technology . stay Mybatis Of SqlMapConfig.xml In profile , through ...

Random recommendation

  1. Swift Basic grammar - memory management , Auto reference count

    1. Working mechanism Swift and OC equally , Using automatic reference counting to manage memory When there is a strong reference to an object , The reference count of the object is automatically +1 When the strong reference disappears , The reference count is automatically -1 When the reference count is 0 when , The object will be destroyed 2 ...

  2. UVA 465 (13.08.02)

     Overflow  Write a program that reads an expression consisting of twonon-negative integer and an ope ...

  3. wpf datagrid row height The automatic calculation of line height makes the line height of each line adaptive to the text

    wpf Of datagrid The line is high Or Auto, Or fixed value : But the trouble is that every row is the same height . When it comes to content ( Mainly wrap A new line textbox or textblock) To dynamically adjust row height , Need to use d ...

  4. Linux CAN Shell Test scripts

    2012-01-13 22:57:14 For my development board 2440 Do secondary development , Added can drive , Did the driver test program , There's no reason not to add a test script ! Modified the test program , Make applications more flexible , Add a pass parameter . next ...

  5. BZOJ5197:[CERC2017]Gambling Guide( shortest path , expect DP)

    Description Given a sheet n A little bit ,m An undirected graph with two sides . You have to start from 1 Go to No n Number point . When you are in x a.m. , You need flowers 1 Yuan , Equal probability randomly buys and x The next point of the ticket , Only through the ticket can we get to other points . Every time a deal is completed ...

  6. Maven CXF wsdl2java XMLGregorianCalendar Type change

    jaxb-bindings.xml To configure : <?xml version="1.0" encoding="UTF-8"?> <jaxb:bindi ...

  7. [leetcode]99. Recover Binary Search Tree Restore binary search tree

    Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing ...

  8. vue Two way binding in

    summary I'm interested in bidirectional binding today , So I checked the related articles , I found that there was a dirty check (angular.js), Useful publishers - Subscriber mode (JQuery), Also useful Object.defineProperty Of (vue), Its ...

  9. e587. Filling Basic Shapes

    There are two ways to fill basic shapes like lines and rectangles. The first is to use specific draw ...

  10. [UI] Pull menu interaction concept - Drop down menu interaction

    Pull menu interaction concept -  Drop down menu interaction http://freebiesbug.com/code-stuff/pull-menu-interaction-conce ...