Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

This article was previously published under Q260097

↑ Back to the top


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 "E_FAIL".

↑ Back to the top


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.

↑ Back to the top


Resolution

To resolve this problem, download MDAC 2.6 from the following Microsoft Web site: 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
    					

↑ Back to the top


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.

↑ Back to the top


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 "_emit 0XF0" 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=<username> value and the pwd=<strong password> 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 = "SQLOLEDB"
cn.ConnectionString = "SERVER=myserver;DATABASE=pubs;uid=<username>;pwd=<strong password>;"
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=<username> value and the pwd=<strong password> 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( "SERVER=myserver;DATABASE=pubs;uid=<username>;pwd=<strong password>;" ) );
	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"SQLOLEDB", & clsid );

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

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

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

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

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

	pIDBProperties->Release();

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

	printf( "We connected\n" );

	hr = pIDBInitialize->Release();

	pIDataInitialize->Release();
}
				

↑ Back to the top


Keywords: KB260097, kbmdac260fix, kbfix, kbdatabase, kbbug

↑ Back to the top

Article Info
Article ID : 260097
Revision : 5
Created on : 11/4/2003
Published on : 11/4/2003
Exists online : False
Views : 263