BUG: SQLOLEDB Treats AutoTranslate, UseProcForPrepare and WSID as Read-Only (240356)



The information in this article applies to:

  • Microsoft SQL Server 7.0

This article was previously published under Q240356
BUG #: 56357 (SQLBUG_70)

SYMPTOMS

The SQL Server 7.0 Books Online section entitled "Initialization and Authorization Properties" details several valid Provider String properties. However, the SQLOLEDB provider treats AutoTranslate, UseProcForPrepare and WSID as read-only properties when evaluating the provider string.

WORKAROUND

The specific DBPROPSET_SQLSERVERDBINIT properties must be set when calling IDBInitialize::Initialize.
  • SSPROP_INIT_AUTOTRANSLATE
  • SSPROP_INIT_USEPROCFORPREP
  • SSPROP_INIT_WSID
The following shows a code snippet that sets the AutoTranslate property.

Note UId <user name> must have permissions to perform these operations on the database.
DBPROP propLogon[1];
DBPROP propTranslate[1];
DBPROPSET gPropSet[2];

gPropSet[0].guidPropertySet = DBPROPSET_DBINIT;
gPropSet[0].cProperties = 1;
gPropSet[0].rgProperties = propLogon;

gPropSet[1].guidPropertySet = DBPROPSET_SQLSERVERDBINIT;
gPropSet[1].cProperties = 1;
gPropSet[1].rgProperties = propTranslate;

VariantInit(&propLogon[0].vValue);
VariantInit(&propTranslate[0].vValue);
	
propLogon[0].dwOptions = 
propTranslate[0].dwOptions = DBPROPOPTIONS_REQUIRED;
	
propLogon[0].colid	
propTranslate[0].colid =  DB_NULLID;

propLogon[0].dwPropertyID = DBPROP_INIT_PROVIDERSTRING;
propLogon[0].vValue.vt = VT_BSTR;
propLogon[0].vValue.bstrVal = SysAllocString("Server=.;Uid=<username>;Pwd=<strong password>;Database=pubs;");		

propTranslate[0].dwPropertyID = SSPROP_INIT_AUTOTRANSLATE;
propTranslate[0].vValue.vt = VT_BOOL;
propTranslate[0].vValue.boolVal = VARIANT_FALSE;																

if(SUCCEEDED(hr = pIDataInit->CreateDBInstance(clsid, NULL, CLSCTX_INPROC, NULL, IID_IDBProperties, (IUnknown **)&pIProps)))
	{
		if(SUCCEEDED(hr = pIProps->QueryInterface(IID_IDBInitialize, (LPVOID*)&pIDBInit)))
		{

			if(SUCCEEDED(hr = pIProps->SetProperties(2, gPropSet)))
				

STATUS

Microsoft has confirmed this to be a problem in SQL Server 7.0.

MORE INFORMATION

If you are using ActiveX Data Objects (ADO) there is a special provider string for AutoTranslate. Use either 'Auto Translate=FALSE' or 'Auto Translate=TRUE'. ADO specifically handles Auto Translate (with a space) and sets the SSPROP_INIT_AUTOTRANSLATE property to VARIANT_TRUE or VARIANT_FALSE accordingly.

Modification Type:MajorLast Reviewed:10/29/2003
Keywords:kbBug kbpending KB240356