Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What if there is a problem when ADO starts the connection?

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "what to do when there is a problem when ADO starts the connection". The content in the article is simple and clear, and it is easy to learn and understand. now please follow the editor's train of thought to slowly deepen, together to study and learn "what to do when there is a problem when ADO starts the connection"!

ADO starts the connection as an efficient .NET programming language. It is a mixture of functional language and object-oriented programming language, and is suitable for programming, algorithm, technology and exploratory development, so you can feel interesting and attractive in the process of using it.

In a client / server application, we can hide the time required to establish and initialize a database connection in several ways, so that the application can open the connection without requiring the user to wait for the application to start. First, we can try to connect asynchronously.

When using an asynchronous connection, after ADO initiates the connection operation, it returns control to the application without waiting for the connection to complete-- so that the application can then perform most of the initialization operations, completing the form_load event processing faster.

If the time to close and re-establish the connection is less than the time it takes for the connection pool to release the connection, then the connection is actually immediate. But in many cases, especially when the number of users is small, it makes more sense to keep the connection open. Inside a middle-tier component or ASP page, if the database query is repeated many times, I recommend that you keep the Connection object open.

Another way to improve connection performance is to avoid using ODBC with DSN. Before Microsoft,ODBC has moved to Quick Fix Engineering (QFE), it means that unless a major BUG is found, the company will no longer spend time on ADO initiating the connection or its drivers. In addition, ADO initiating connections is also a concern when considering performance and deployment issues. DSN must be installed on the customer's system, requiring a registry lookup, compared to an OLE DB connection

It takes longer to establish a connection-especially if you specify a ConnectionString using direct encoding. In practical terms, the overhead reduction to avoid using DSN is limited: if you cancel the connection establishment process completely, you may have two to five seconds left for each connection (assuming there are no connections in the database connection pool). However, if your application needs to establish connections frequently, the cumulative time savings can be significant.

When establishing a database connection, you need to select a data provider. Microsoft recommends that we use the ADO initiation connection provider instead of the default ODBC provider. Compared with the OLE DB local provider of * * and the similar but earlier ODBC provider, I find the former less unpleasant surprises. But in either case, you should test the application completely before deciding to use a new provider-the code's performance, supported functionality, and behavior can all change.

In the middle tier and ASP, we cannot (in practice) create scalable components while keeping the connection open-- at least between multiple calls. In general, when IIS references and releases instances of components and ASP pages, components and ASP pages are frequently loaded and discarded. Because ADO-based code must establish, use, and release database connections every time it is executed, the strategy of minimizing connection complexity improves performance to a measurable level. Under these circumstances,

For the speed at which we connect to the database, it is important for ADO to start a connection / session pool. If you specify the appropriate value for the ConnectionString property of the Command object (that is, each time you use the same server, initial directory, login ID, and other parameters), there is a good chance that the connection is already open and available. If a matching connection can be found in the connection pool, the connection (or reconnection) time will be close to 0 (usually less than 250 ms).

However, if the ADO (or VB) code does not release the Connection object, or if we change the ConnectionString,OLE DB between different instances, we must establish a new connection one at a time. If this happens, we will quickly run out of available connections in the connection pool. To ensure that the connection is released, we must set the Connection object to Nothing after closing the connection. In addition, ADO starts the connection instead of using ConnectionString in the Recordset Open method, but opens the Connection object in a separate way; this makes it convenient to reference the Connection object when we want to close it and set it to Nothing.

Thank you for your reading, the above is the content of "what to do when there is a problem when ADO starts the connection". After the study of this article, I believe you have a deeper understanding of what to do when there are problems when ADO starts the connection, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report