OleDbOrc.exe: Using the OLE DB Cursor Engine Service to Provide Updatability for OLE DB ProvidersID: Q223333
|
Some OLE DB providers, such as Microsoft's Oracle OLE DB Provider, do not support updating via IRowsetChange, although they do support updating via SQL UPDATE statements. In this case, the OLE DB Cursor Engine service can be used to allow the provider to be updatable via IRowsetChange.
OleDbOrc.exe is a self-extracting executable containing two files, SDKServiceSample.cpp and VCServiceSample.cpp, that demonstrate how to invoke the OLE DB services when using the Oracle OLE DB Provider so that you can get the IRowsetChange interface and perform updates, insertions, or deletions.
SDKServiceSample.cpp uses OLE DB SDK function calls while VCServiceSample.cpp uses the OLE DB Consumer template C++ classes.
To build the samples, bring the .cpp file into the Visual C++ development environment and choose Build. The program will ask whether you want a default workspace created, choose Yes.
The following file is available for download from the Microsoft
Software Library:
OleDbOrc.exeRelease Date: May-27-1999
Q119591 How to Obtain Microsoft Support Files from Online Services
Filename | Size |
---|---|
SDKServiceSample.cpp | 8KB |
VCServiceSample.cpp | 3KB |
// The Init Prompt
InitProperties[0].dwPropertyID = DBPROP_INIT_PROMPT;
InitProperties[0].vValue.vt = VT_I2;
InitProperties[0].vValue.iVal = DBPROMPT_NOPROMPT;
// Data source string.
InitProperties[1].dwPropertyID = DBPROP_INIT_DATASOURCE;
InitProperties[1].colid = DB_NULLID;
InitProperties[1].vValue.vt = VT_BSTR;
InitProperties[1].vValue.bstrVal = SysAllocString(OLESTR("dseoracle"));
// User ID.
InitProperties[2].dwPropertyID = DBPROP_AUTH_USERID;
InitProperties[2].vValue.vt = VT_BSTR;
InitProperties[2].vValue.bstrVal = SysAllocString(OLESTR("demo"));
// Password.
InitProperties[3].dwPropertyID = DBPROP_AUTH_PASSWORD;
InitProperties[3].vValue.vt = VT_BSTR;
InitProperties[3].vValue.bstrVal = SysAllocString(OLESTR("demo"));
// Load the service components.
InitProperties[4].dwPropertyID = DBPROP_INIT_OLEDBSERVICES;
InitProperties[4].vValue.vt = VT_I4;
InitProperties[4].vValue.lVal = DBPROPVAL_OS_ENABLEALL;
rgInitPropSet.guidPropertySet = DBPROPSET_DBINIT; // The property set.
rgInitPropSet.cProperties = 5; // # of properties being set.
rgInitPropSet.rgProperties = InitProperties; // Array of DBPROP structures.
...
if (FAILED(hr = CoCreateInstance(CLSID_MSDAINITIALIZE, NULL,
CLSCTX_INPROC_SERVER, IID_IDataInitialize,
(void**)&pDataInit)))
RETURN(hr)
// Creating the IDBInitialize.
if(FAILED(hr = CLSIDFromProgID(wszProvider, &clsid)))
RETURN(hr)
if(FAILED(hr = pDataInit->CreateDBInstance(clsid, NULL,
CLSCTX_INPROC_SERVER, NULL, IID_IDBInitialize, (IUnknown**)
&pDataSourceIDBInitialize)))
RETURN(hr)
// Setting the initialization properties.
if(FAILED(hr = pDataSourceIDBInitialize->QueryInterface(IID_IDBProperties,
(void**)&pProperties)))
RETURN(hr)
if(FAILED(hr = pProperties->SetProperties(1,&rgInitPropSet)))
RETURN(hr)
if (FAILED(hr = pDataSourceIDBInitialize->Initialize( )))
RETURN(hr)
CDataSource ds;
ds.OpenWithServiceComponents("MSDAORA", propset);
Once the datasource is opened using the service components, any rowsets created with ICommand::Execute() use the cursor engine if the provider doesn't provide the necessary functionality (scrolling and updating for example).Q223417 Bug: Cursor Services Not Used: Execute Called from ICommandText
Additional query words:
Keywords : kbfile kbDatabase kbOLEDB kbOracle kbConsumer kbVS600sp2 kbGrpVCDB kbGrpMDAC kbMDAC200 kbMDAC150
Version : WINDOWS:1.5,2.0,6.0 SP2
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: June 2, 1999