JDBC Database connection Pool

Source: Internet
Author: User

Overview

The database connection pool was learned at. NET and has been exposed in SQL Server, but when used, it's very important because, VS and SQL Server and the operating system are Microsoft's, others have made a good integration, when we use the database connection pool, Just need to modify the corresponding connection string, but, in Java is not the same, because Java is open source, he only provides a standard, the rest, no matter which company can be implemented, well, to the next, we continue to say our database connection pool.


no connection pooling and connection poolingNo database connection pool
There is a database connection pool


implementation of database connection pooling

Java is open source, son company itself does not implement the database connection pool, but there are many third-party implementations of the framework, such as: Tomcat, DBCP and C3P0, of course, we can also implement the database connection pool, due to their own implementation of the database connection pool specific code is not provided here, So, here's a description of the process of implementing your database connection pool.

Define a factory class that defines a dynamic proxy that declares a collection within the factory class, creates a specified number of database connection objects when the factory class initializes, and puts them into the collection, the dynamic method inside the proxy class determines whether the connection object is a closed method, and if so, puts the proxy object into the collection in the Factory class ( When removed, subtracts the object from the collection).

Their own implementation of the database connection pool of the general idea is this, interested students can realize, the following provides a demo of Tomcat, DBCP and C3P0.


Summarydatabase connection pooling is one aspect of system optimization, and there are many other aspects, such as caching, server optimization.


JDBC Database connection Pool

Contact 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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.