Ado. NET and database connections
Q: Please briefly describe the mechanism of database connection pooling
A database connection pool is a buffer pool that stores database connections. Ado. NET provides the database connection pool service to the upper-level user, and the database connection that is used is selected to remain in the database connection pool for the next use. When a user requests a connection string for a database connection, the database connection pool tries to find a connection in the pool that has the same connection string and provides it directly to the user.
Q: How to increase the reuse rate of connections within a connection pool
In order to improve the reuse rate of database connection pool, the only way is to ensure that the connection string used by the system to access the database is the same. For example, unified use of the Superuser account can further unify the connection string, but this poses a security risk to the system.
What is the role of q:commandbehavior.closeconnection
commandbehavior.closeconnection resolves a situation in which the database connection cannot be closed effectively in streaming read data mode. When a Xxxdatareader object is built with CommandBehavior.CloseConnection, the database connection is automatically closed when the Xxxdatareader object is closed.
Using the ADO read and write database
Q:ado. NET supports which two methods to access the relational database
Connected and offline. The connection is suitable for large data volumes, and the offline type is suitable for small data volume reading operations.
Excerpt from-it Enterprise must read 200. NET face Questions-09. NET database development in