In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "how to use ADO.NET connection pool", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "how to use ADO.NET connection pool" this article.
ADO.NET connection pooling allows applications to get a connection from the connection pool and use that connection without having to reestablish a connection for each connection request. Once a new connection is created and placed in the connection pool, the application.
Tips and tips
1. Create a connection pool when you need a database connection, not in advance. Close the connection as soon as you finish using it, and don't wait for the garbage collector to deal with it.
2. Ensure that all user-defined transactions are closed before closing the database connection.
3. Do not close all connections in the database, at least one connection is available in the connection pool. If memory and other resources are your first consideration, you can close all connections and create a connection pool when the next request arrives.
ADO.NET connection Pool faq
1. When will the connection pool be created?
Create a connection pool when * connection requests arrive; the establishment of the connection pool is determined by the connection character creation of the database connection. Each connection pool is associated with a different connection string. When a new connection request arrives, if the connection string is the same as the string used by the connection pool, a connection is removed from the connection pool; if it is different, a new connection pool is created.
2. When do I close connection pooling?
Close connection pooling when all connections in the connection pool are closed.
3. What happens when all the connections in the connection pool are used up and a new connection request arrives?
When the connection pool has reached its number of connections, when new connection requests arrive, new connection requests will be placed in the connection queue. ADO.NET connection pool when a connection is released to the connection pool, the connection pool allocates newly released connections to connection requests queued in the queue. You can call close and dispose to return the connection to the connection pool.
4. How should I allow connection pooling?
For. Net applications, connection pooling is allowed by default. (this means you don't have to do anything about it.) of course, if you can add pooling=true; to the connection string of the sqlconnection object, make sure your application allows the use of connection pooling.
5. How should I disable ADO.NET connection pooling?
Ado.net allows database connection pooling by default. If you want to disable connection pooling, you can use the following methods:
1) when using the sqlconnection object, add the following to the connection string: pooling=false
2) when using the oledbconnection object, add the following to the connection string: oledb services=-4
Oling=true; make sure your application allows the use of ADO.NET connection pooling.
5. How should I prohibit connection pooling?
Ado.net allows database connection pooling by default. If you want to disable ADO.NET connection pooling, you can use the following methods:
1) when using the sqlconnection object, add the following to the connection string: pooling=false
2) when using the oledbconnection object, add the following to the connection string: oledb services=-4
The above is all the contents of the article "how to use ADO.NET connection Pool". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.