7.5.1.Using the OLE DB Provider for Virtuoso

Being a COM in-process server VIRTOLEDB has to be installed on the client computer. When VIRTOLEDB is properly installed it can be used by a host of existing applications thanks to the support of standard OLE DB interfaces.

System Requirements

VIRTOLEDB requires the following software:

  • Windows 98, ME, NT4.0, 2000, or XP.

  • Virtuoso Server running on the same or remote computer.

  • Redistributable files provided with Microsoft Data Access Components (MDAC) 2.5 or higher. Note that this version of MDAC comes along with Windows 2000. It is also available (as well as other versions of MDAC) at the Microsoft Web site: http://www.microsoft.com/data/

Installing the Provider

VIRTOLEDB is installed as a part of Virtuoso installation on a Windows platform. The following files pertain to the OLE DB Provider for Virtuoso.

Table7.17.OLE DB Provider for Virtuoso Files

File Description
virtoledb.dll DLL that implements the VIRTOLEDB provider.
virtoledb.h Header file for development of VIRTOLEDB consumers.

The installation procedure, in addition to placing VIRTOLEDB files on a client computer, also registers VIRTOLEDB in the system to make it known as a COM server. This also makes it available through the OLE DB root enumerator object and the Data Links component.

Invoking the Provider

Applications that utilize OLE DB Data Links component can use VIRTOLEDB without any specific measures. Applications that need to directly invoke VIRTOLEDB should follow examples provided in this section.

Using Data Link User Interface

Data Links is a user interface component for connecting to OLE DB data sources and constructing ADO-style connection strings. It belongs to OLE DB core components and is a part of MDAC. It is used my many applications including development environments like MS Visual Studio.

VIRTOLEDB uses the extension mechanism of the Data Link API and provides a customized version of the Data Link connection page.

Figure7.33.Data Link Provider Page

Data Link Provider Page

Figure7.34.Data Link Connection Page

Data Link Connection Page

Using COM and OLE DB Interfaces Directly

Applications that utilize OLE DB Data Links component can use VIRTOLEDB without any specific measures. Applications that need to directly invoke VIRTOLEDB should follow examples provided in this section.

#define INITGUID
#include "virtoledb.h"

..

  IDBInitialize* pIDBInitialize = NULL;
  HRESULT hr = CoCreateInstance(CLSID_VIRTOLEDB, NULL, CLSCTX_INPROC_SERVER,
                                IID_IDBInitialize, (void**) &pIDBInitialize);
  if (FAILED(hr))
    goto EXIT;
ADO Applications
Dim strConn As String
Dim objConn As ADODB.Connection

strConn = "Provider=VIRTOLEDB;Data Source=localhost:1111;User Id=dba;Password=dba;Initial Catalog=Demo;Prompt=NoPrompt;"

Set objConn = New ADODB.Connection
objConn.CursorLocation = adUseServer
objConn.Open strConn