Connect pool with Microsoft SQL Server 2000 Analysis Services

xiaoxiao2021-03-06  20

Suitable for: Microsoft® SQL ServerTM 2000 Analysis Services

Summary: Learn how to develop connecting pool objects included with Microsoft XML for Analysis Provider

Scalable client and web application for Microsoft SQL Server 2000 Analysis Services

table of Contents

Introduction

reader

Connection pool object

Use the connection pool object

Request and return connection

Balance and contraction connection pool

AdoconPool object

OLEDBCONPOOL object

summary

other information

Introduction

Resource Management is an important issue that develops scalable clients and web-based applications. Inhibit

When making a client application that provides services for many concurrent users, the guiding principles of resource management are to allocate as much as possible.

Source and unablyately demonstrate resource allocation. Available resources (such as memory, process threads, and network or database connections)

Sexuality is directly related to the performance of the client application and the satisfaction of the user. Therefore, with the continuous expansion of the client application

By further control of resource management, the connection pool can reduce the impact of scalability. Connecting pool to make the client

The program can establish a connection between the connection pool and the given resource without re-establishing the connection at each time. In even

After the connection is established in the pool, the client application can reuse the connection without having to perform a complete connection process.

Because the client application does not need to set up and close the connection repeatedly, the connection to the pool buffer will significantly improve connectivity.

can. The time required for this process should be used in the client that uses a longer hysteresis time (such as Internet or network connection).

It is especially important to use programs. When the client application is no longer needed, the connection returns to the connection pool.

In addition to improve performance, use the connection pool to manage resources more effectively, and will not apply client applications.

Programs increase additional resource management fees. The connection pool manager can allocate and unassign the connection to maintain the connection pool as needed.

To support web client applications using Microsoft SQL Server 2000 Analysis Services

The retractable needs, the connection pool function has been implemented in Microsoft XML for Analysis Provider. Xml

For Analysis Provider automatically uses the connection pool, you can also mention other users who don't need to use the provider itself.

The client application for XML connections use this feature. This article is intended to introduce some objects, and they can be fully profound.

Use the connection pool in the Analysis Services client application.

reader

This article assumes that the reader has SQL Server 2000 Analysis Services and Microsoft

ActiveX® Data Objects (ADO) and OLE DB Data Access Technology Basic Knowledge. Related examples

Microsoft Visual Basic® and Microsoft Visual C ® are found.

Connection pool object

Two objects are available in XML for Analysis Provider: AdoconPool and OLEDBConPool.

AdoConPool objects are used to manage ADO connection objects; OLEDBCONPOOL objects are used to manage OLE DB session objects.

Although the connection pool types provided by both objects are different, they all use the same basic mechanism to manage the connection pool. In this

When this shared mechanism is discussed, use the term "connection" to describe the ADO connection object and the OLE DB session object.

The connection pool mechanism is only available for Microsoft SQL Server 2000 Service Pack 1 (SP1),

Updated Microsoft OLE DB Provider for OLAP Services 8.0 (MSOLAP.2) OLE DB

Use the connection pool object to support the programming language that supports ADO or OLE DB data access technology, you can use AdoconPool and

OLEDBCONPOOL object. However, to use these objects in the Visual C program, you must add the following in the program.

Compiler instructions to include the correct header files and properties:

"tagpropvariant") Rename ("_ large_integer", "")

Rename ("_ ularge_integer", "")

Using namespace msxmlanalysisclib;

Request and return connection

The mechanisms used from the connection pool request connection differ from the OLE DB resource pool to quickly access web-based applications.

Ask the mechanism used. Connecting pool objects divide the active connection pool into two groups: "Available Connections" and "Use Connections". Available connection

The connection consists of the currently not assigned to the client application; the used connection refers to the currently allocated to the client application and is

Connection requests require special authentication and simulation mechanisms. When connected via the application (

AdoConPool object uses the getConnection method, while the OLEDBCONPOOL object uses a GetSession method)

The connection pool attempts to retrieve the available connection, the search condition is the domain name and user name used by the connection and the client application.

The security identifier (SID) is the same. If a matching available connection is found, return it to the client application.

If you do not find the connection with the client SID information, the connection pool object will pass the connection to the client request.

Information is analyzed to determine if there is an available connection to the same request database in the connection pool. If you find a match

Database, connecting pool objects attempt to make roles security of client requests with the role security of existing available connections

Match. If you find that role security is matched, the connection pool object will then compare the username and client request for the available connection.

username. If the username also matches, return the available connections to the client application. If the username does not match, the root is

According to the role security on the Analysis server, use the client request domain and username to re-verify the available connections, then

If you do not find a matching role security and database, create a new connection in the connection pool and assign it to send it.

This method also has an advantage compared to the method usually adopted with resource sharing, that is, issuing a request client application

An existing active connection with the same role security permissions can be reused, even if the connection is initially requested by other users.

. The new user name associated with the available connection is still verified, so it is possible to maintain its security, and the connection can be

Provided to the client. This shortens the connection time for client applications that provide services in a large number of concurrent users to reduce the fee.

This mechanism is efficient for those client applications that perform a large number of operations and need to repeat requests and return to the connection.

higher. The same activity can be returned to a requestible client application.

For client applications, it is a very simple process that returns a connection to the connection pool. Client application

Pass the connection reference to the connection pool object (AdoConPool object uses the returnConnection method, and

OLEDBConPool object uses the returnSession method). Connecting to the pool object verify that the connection object is indeed

Precautions

If the user requests a connection, release it, then request another connection from the connection pool object, according to the connection

The active connection in the pool will re-verify the simulation mechanism used by the user will return the same connection without repeated access.

Analysis server. If the role permissions have changed after the user releases the first connection request, the second request will

For example, the role of a user on the Analysis server is Role A. Role A allows users to run queries for two cube Cube A and Cube B. When the client application used by this user first requests the connection, return

The connection has the right to access Cube A and Cube B. The client application runs the query and then releases the connection.

The administrator of the Analysis server now changes the access rights of Role A to only access Cube A. If this user

The client application requests another connection. The connection created when the first request will return to the client application again.

However, it still has access to Cube A and Cube B. Although Role A corresponds to users can only access Cube A

However, the Query will continue to execute the query on Cube B, as if this user still has access to access rights.

This problem will only occur only to reassign an active connection; the newly created connection will always enter the Analysis server.

Validation. If the client application first requested the active connection of the client application is timeout, the system will be the client.

The application assigns a newly created connection, then the connection has the correct role permissions.

For web applications, the easiest way to solve this problem is every time the role on the Analysis server occurs.

Restart the Microsoft Internet Information Services (IIS) when changing, enforce applications in request

Given the characteristics of IIS thread management, when you create a web-based application, in Active Server

Pages (ASP) Web applications should be particularly careful when using AdoconPool and OLEDBCONPOOL connection pool objects.

. IIS checks each COM component to determine its flexibility (the thread processing of COM components and the ability to block processing.). Xml

For Analysis Provider supports the free thread module, but does not provide free thread encapsulators (FTMs). Entirely

This reason, IIS 5.0 or higher believe that XML for Analysis Provider is not flexible.

This means that if you use the default settings of IIS 5.0 or higher, AdoconPool and OledbconPool pairs

Like the application or session scope cached in the ASP application (in other words, cache in the ASP

System security context will be used in Application or Session object variables. Request and return to the connection

The simulation mechanism will not work properly. Connection pool objects will use the default IIS user when trying to verify all active connections

To correct this error, configure the IIS 5.0 or higher in the configuration database

AsptrackthReadingModel settings are changed to TRUE. Change this setting to prevent IIS from checking the spirit of COM components

Activity, however, this will result in a decrease in performance, so it should only contain Web

This setting is changed in a virtual directory or web directory.

Balance and contraction connection pool

The number of connections contained in the connection pool has no strict limit, because the basic management mechanism has been designed as unobstructed mechanism, ie

Client applications should be accessible when requesting a connection. It is because of the characteristics of unobstructed, two objects can be used

However, two different technologies can also be used to manage connection pools: "Balance" and "shrink".

Balance connection pool

Return the connection to the connection pool (AdoConPool object uses the ReturnConnection method, and

The balancing technology is used when the OLEDBConPool object uses the ReturnSession method. Connecting pool objects will take activities

The total number of connections (used connections and available connections) is compared to the maxsessions attribute value to determine if there is a need to balance the connection pool. If the total number of active connections is greater than the maxsessions attribute value, you will need to make a balance.

In order to balance the connection pool, the connection pool object will be available to the available connection according to the number of seconds passed since the last access to each available connection.

The group is sorted. The object then removes those available for the longest available connection one by one until the connection and available connections are used.

The total number is less than the maxsessions attribute value or there is no available connection to any activity.

Note: Do not use the Timeout property when balanced.

Contraction connection pool

Whenever the client application calls the SHRINK method of AdoConPool or OLEDBConPool object,

To the shrinkage technology. This technique is for expired available connections. Connecting pool objects will put last visit for each available connection

The time is compared to the current system time. If the number of seconds of the difference is greater than the timeout attribute value, the available connection will be deleted.

However, both technologies do not apply to management has been used. After completing an operation, the client application is responsible

Return the connection to the connecting pool, which can be reassigned as a available connection. Connecting pool objects do not try

The diagram management has been used, but only to balance and shrink the available connections. Use this method between performance and resource management

AdoconPool object

AdoConPool objects provide connecting pools for client applications that use ADO data access technology to maintain

AdoConPool objects have the following properties and methods:

MAXSESSIONS attribute

The maxsessions property is used to limit the number of ADO connection objects (including available connections and use connections) in the connection pool.

type of data

Long integer

Authority

Read / write

Note

Since the connection pool mechanism is designed to have no obstruction mechanism, the connection pool is not used without the use of the MAXSESSES attribute.

growth of. Instead, this value is used to balance and shrink the pool by ReturnNECTION and SHRINK methods. Balance

And shrink details, see the balance and contraction connection pools described earlier herein.

Sessions attribute

The sessions property returns the number of active ADO connection objects in the connection pool.

type of data

Long integer

Authority

Read-only

Note

The sessions property reports the total number of connections managed by AdoConPool objects (including use connections and available connections)

TimeOUt property

TimeOUt property settings or returns the number of seconds available to the ADO Connection object to maintain the active state.

type of data

Long integer

Authority

Read / write

Note

Similar to the maxsessions attribute, the Timeout property is used by the Shrink method to identify the delete from the connection pool.

Activity is available. For more information on shrinkage, see Balance and Shrinking Pools.

GetConnection method

If a given connection string, the getConnection method returns an ADO Connection object.

grammar

C

HRESULT GETCONNECTION ([in] bstr in_bstrcn, [out, return] idispatch **

Visual Basic

SET IO_PPADOCONNECTION = Object.getConnection (In_Bstrcn As String)

Object

Effective reference to the AdoConPool object.

IN_BSTRCN

Suitable for the connection string of the ADO Connection object.

IO_PPADOCONNECTION

Returned ADO Connection object reference.

Note

This method tries to request an existing available connection from the connection pool by matching connection and security information before creating a new connection.

Pick up. For more information on requesting the connection, see Request and Return.

The ReturnConnection method returnconnection method returns the ADO Connection object to the connection pool.

grammar

C

HRESULT RETURNCONNECTION ([IN, OUT] iDispatch ** io_ppadoconnection)

Visual Basic

Object.returnconnection IO_PPADOCONNECTION IO_PPADOCONNECTION

Object

Effective reference to the AdoConPool object.

IO_PPADOCONNECTION

To return to the ADO Connection object of the connection pool.

Note

After using this method to return to the connection, the connection pool object automatically balances the available connections. Detailed information about balanced connection,

SHRINK method

When the SHRINK method is called, it will terminate the expiration available ADO connection object and delete it from the connection pool.

grammar

C

HRESULT Shrink ()

Visual Basic

Object.shrink

Object

Effective reference to the AdoConPool object.

Note

The client application should call this method periodically to terminate and delete the available connections that have been expired. Contract connection

For more information, see Balance and Contract Pool.

OLEDBCONPOOL object

OLEDBCONPOOL objects provide connecting pools for client applications using OLE DB data access technology,

Guard OLE DB session object. OLEDBCONPOOL objects apply to those who directly use OLE DB to client data

Visual applications, while most enabled Web applications should use the AdoconPool connection pool object.

MAXSESSIONS attribute

The maxsessions property is used to limit the number of OLE DB session objects in the connection pool (including available sessions and use sessions).

type of data

Long integer

Authority

Read / write

Note

Since the connection pool mechanism is designed to have no obstruction mechanism, the connection pool is not used without the use of the MAXSESSES attribute.

growth of. Instead, this value is used to balance and contract the pool by ReturnSession and SHRINK methods. About balance

For more information, please refer to Balance and Contract Pool.

Sessions attribute

The sessions property returns the number of active OLE DB session objects in the connection pool.

type of data

Long integer

Authority

Read-only

Note

The sessions property reports the total connection by the OLEDBConPool object (including the used connection and available connections)

TimeOUt property

TimeOUT property settings or returns the number of seconds available to the OLE DB session object to hold the active state.

type of data

Long integer

Authority

Read / write

Note

Similar to the maxsessions attribute, the Timeout property is used by the Shrink method to identify the delete from the connection pool.

Activity is available. For more information on shrinkage, see Balance and Shrinking Pools.

Getsession method

If a set of OLE DB properties is given, the GetSession method returns the OLE DB session object.

grammar

C

HRESULT GETSESSION ([in] int in_cpropsets, [in] dbpropset * in_ppropsets,

[OUT, RETVAL] IDBCREATECOMMAND ** IO_PPSESSION)

IN_CPROPSETS

The length of the tagdbpropset type structure referenced in the in_PPROPSets parameter is in bytes.

IN_PPROPSETS

The pointer to the tagdbpropset type structure for identifying and (if necessary) creates an OLE DB session object. related

For more information on TagDbPropset types, see dbpropsetio_ppsession in OLE DB Document (English)

Returned OLE DB session object reference. Object references are converted to IDBCREATECMMAVAND OLE DB interface. Have

For more information on the IDbcreateCommand interface, see the OLE DB Document (English)

Note

This method tries to request an existing available connection from the connection pool by matching connection and security information before creating a new connection.

Pick up. For more information on requesting the connection, see Request and Return.

ReturnSession method

ReturnSession method returns the OLE DB session object to the connection pool.

grammar

C

HRESULT RETURNSESSION ([IN, OUT] IDBCREATECOMMAND ** IO_PPSESSION);

IO_PPSession

Returns the OLE DB session object to the connection pool.

Note

After using this method to return to the connection, the connection pool object automatically balances the available connections. Detailed information about balanced connection,

SHRINK method

When the SHRINK method is called, it will terminate the expiration of the OLE DB session object and delete it from the connection pool.

grammar

C

HRESULT Shrink ()

Note

The client application should call this method periodically to terminate and delete the available connections that have been expired. Contract connection

summary

The connection pool is an effective resource management method. Use Microsoft XML for Analysis Provider

Part of the connected pool object, you can extend this resource management method to use Microsoft SQL Server

2000 Analysis Services client applications, thereby reducing expenses in the development and implementation, with low cost

High performance.

转载请注明原文地址:https://www.9cbs.com/read-73212.html

New Post(0)