Microsoft KB Archive/260097

= BUG: OLE DB Resource Pooling Fails on Non-Pentium Class Computers =

Article ID: 260097

Article Last Modified on 11/4/2003

-

APPLIES TO


 * Microsoft Data Access Components 2.5

-



This article was previously published under Q260097



SYMPTOMS
A connection to any database with ActiveX Data Objects (ADO) or OLE DB will fail on non-Pentium class computers when you are using a provider that has resource pooling enabled. By default, ADO always invokes OLE DB services, and therefore resource pooling is enabled when you connect to a database.

From ADO, a call to ADODB.Connection.Open returns the following error message:

Run-time error '-2147467259 (80004005)'

Unspecified error

From OLE DB, a call to IDBInitialize->Initialize returns &quot;E_FAIL&quot;.



CAUSE
When OLE DB is in the process of initializing the resource pool linked list, it must move a 64-bit integer that is a member value within each node of the list. OLE DB is using a Pentium-specific instruction to move the bits of the integer value, and this instruction is not available on non-Pentium class computers.



RESOLUTION
To resolve this problem, download MDAC 2.6 from the following Microsoft Web site:

http://msdn.microsoft.com/dataaccess

To work around the problem you can disable resource pooling. There are two ways to do this:  You can disable resource pooling in the registry for the OLE DB provider by setting the OLEDB_SERVICES key of the OLE DB provider to 0xfffffffe .  You can disable resource pooling programmatically by specifying OLE DB Services=-2 in the connection string when you are using either ADO or the OLE DB DataLink services. In a C++ application that consumes an OLE DB provider, you can set the DBPROP_INIT_OLEDBSERVICES initialization property to: DBPROPVAL_OS_ENABLEALL & ~DBRPOPVAL_OS_RESOURCEPOOLING 



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This problem was corrected in MDAC 2.6.



MORE INFORMATION
The following code executes the same machine instruction as OLE DB, and this will fail on non-Pentium class computers: void main {

__int64 dummy; __int64 xch; __int64 comp; volatile __int64* pDest = & dummy;

__asm {       mov esi,pDest mov eax,DWORD PTR comp[0] mov edx,DWORD PTR comp[4]

mov ebx,DWORD PTR xch[0] mov ecx,DWORD PTR xch[4]

_emit 0xF0 _emit 0x0F _emit 0xC7 _emit 0x0E } } When this code is run on a non-Pentium class computer, it fails on the call to &quot;_emit 0XF0&quot; because non-Pentium class CPUs do not have this instruction available.

ADO
The following ADO code produces the 0x80004005 error:

Note You must change the uid= value and the pwd= value to the correct values before you run this code. Make sure that uid has the appropriate permissions to perform this operation on the database.

Dim cn As New ADODB.Connection

cn.Provider = &quot;SQLOLEDB&quot; cn.ConnectionString = &quot;SERVER=myserver;DATABASE=pubs;uid= ;pwd= ;&quot; cn.Open

C++ / OLE DB
The following C++ OLE DB code results in an E_FAIL error message on the call to IDBInitialize->Initialize:

Note You must change the uid= value and the pwd= value to the correct values before you run this code. Make sure that uid has the appropriate permissions to perform this operation on the database. void main {       HRESULT hr; CLSID clsid; const ULONG nProps = 1; IDBProperties * pIDBProperties = NULL; IDataInitialize * pIDataInitialize = NULL; DBPROP InitProperties[ nProps ]; DBPROPSET rgInitPropSet;

InitProperties[ 0 ].dwPropertyID = DBPROP_INIT_PROVIDERSTRING; InitProperties[ 0 ].vValue.vt = VT_BSTR; InitProperties[ 0 ].vValue.bstrVal = SysAllocString( OLESTR( &quot;SERVER=myserver;DATABASE=pubs;uid= ;pwd= ;&quot; ) ); InitProperties[ 0 ].dwOptions = DBPROPOPTIONS_REQUIRED; InitProperties[ 0 ].colid = DB_NULLID; InitProperties[ 0 ].dwStatus = DBPROPSTATUS_OK;

rgInitPropSet.guidPropertySet = DBPROPSET_DBINIT; rgInitPropSet.cProperties = nProps; rgInitPropSet.rgProperties = InitProperties;

hr = CoInitialize( NULL );

CLSIDFromProgID( L&quot;SQLOLEDB&quot;, & clsid );

if( FAILED( CoCreateInstance(CLSID_MSDAINITIALIZE, NULL, CLSCTX_INPROC_SERVER,   IID_IDataInitialize, (void**)&pIDataInitialize) ) ) {       printf( &quot;Failed to load services\n&quot; ); return; }

if( FAILED( hr = pIDataInitialize->CreateDBInstance(clsid, NULL, CLSCTX_INPROC_SERVER,        NULL, IID_IDBInitialize, (IUnknown**)&pIDBInitialize) ) ) {       printf( &quot;CreateDBInstance Failed\n&quot; ); return; }

pIDBInitialize->QueryInterface( IID_IDBProperties,       ( void ** ) & pIDBProperties );

if( FAILED( pIDBProperties->SetProperties( 1, & rgInitPropSet ) ) ) {       printf( &quot;failed to set properties\n&quot; ); return; }

SysFreeString( InitProperties[ 0 ].vValue.bstrVal );

pIDBProperties->Release;

if( FAILED( hr = pIDBInitialize->Initialize ) ) {       printf( &quot;initialization failed\n&quot; ); return; }

printf( &quot;We connected\n&quot; );

hr = pIDBInitialize->Release;

pIDataInitialize->Release; }

Additional query words: Session connection

Keywords: kbbug kbfix kbdatabase kbmdac260fix KB260097

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.