TAILIEUCHUNG - Microsoft SQL Server 2005 Developer’s Guide- Part 22

Microsoft SQL Server 2005 Developer’s Guide- P22:SQL Server 2005 is a feature-rich release that provides a host of new tools and technologies for the database developer. This book is written to help database developers and DBAs become productive immediately with the new features and capabilities found in SQL Server 2005. | Chapter 6 Developing Database Applications with 189 A string variable containing the server name is passed in to the beginning of this subroutine and then two SqlConnection objects cn and cn2 are created that have identical connection strings. In both cases the ConnectionString property uses the SERVER keyword to identify the SQL Server instance to connect to and the INTEGRATED SECURITY keyword to specify that Windows integrated security will be used. After the two SqlConnection objects have been created a Try-Catch loop is used to open the connection to SQL Server and capture any run-time errors. Since the values of these connection strings are identical they will both be part of the same connection pool. If the connection strings were different in any way then two separate connection pools would have been created. After the connections have been established the Close method is used to close each connection. Pooling Related Connection String Keywords While the .NET Framework Data Provider for SQL Server automatically handles connection pooling for you there are still several connection string keywords that you can use to alter the SQLConnection object s connection pooling behavior. Table 6-2 presents the ConnectionString values you can use to customize the SQL Server .NET Data Provider s connection pooling behavior. Name Description Connection Lifetime After a connection is closed it s returned to the pool. Then its creation time is compared with the current time and the connection is destroyed if the difference exceeds the value specified by Connection Lifetime. A value of 0 specifies that pooled connections will have the maximum lifespan. Connection Reset When True this specifies that the connection is reset when it s removed from the pool. For Microsoft SQL Server version you can set this value to False to avoid an additional server round trip after opening a connection. However the previous connection state and database context will not be reset. .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.