OLE DB and ADO Clients

On Windows platforms, you can create a client of the ObjectStore Component Server using the standard interfaces provided by OLE DB and ADO. When you install the Component Server Framework, the installation program automatically registers the Component Server as a version 1.5 OLE DB provider.

Operations defined with the Server API can be executed in OLE DB or ADO as commands, and lists of OSTC objects returned by Server operations can be accessed as Rowsets or RecordSets.

What Is OLE DB?

OLE DB is Microsoft Corporation's component database architecture, which is the fundamental component object model (COM) building block for storing and retrieving records. This set of interfaces for accessing and manipulating data provides data integration regardless of data type. Microsoft's Open Database Connectivity (ODBC) data access interface is included in the OLE DB architecture, and continues to provide access to relational data.

You can access OLE DB providers through ActiveX Data Objects (ADO). ADO is a high-level object model that provides access to any OLE DB source. The ADO interface is similar to the Data Access Objects (DAO) interface and the Remote Data Objects (RDO) interface.

For details about the OLE DB object model, refer to the Microsoft OLE DB SDK. To obtain a complete description of the ADO object model, consult the on-line documentation for Microsoft Visual Basic, Active Server Pages, or Visual C++. For more information about OLE DB and ADO, browse the Microsoft web site at http://www.microsoft.com/data.

Using ADO to Create a Client of the Component Server

The examples included with the Framework installation show how to access ObjectStore Thin Client OLE DB through ADO from a Visual Basic or ASP/VBScript application.

In general, to open an OSTC OLE DB connection, provide a string in this format:

provider=ObjectStore Thin Client OLE DB Provider;
data source=service-name;
[router=router_name:port_number]

where

For example, using ASP and ADO you can create and open an OLE DB connection to the provider:

Set adoConnection = Server.CreateObject("ADODB.Connection")
Call adoConnection.Open(
      "provider=ObjectStore Thin Client OLE DB Provider; \
      data source=service-name"
)

Then you can open a RecordSet:

Set RS = Server.CreateObject("ADODB.RecordSet")
Call RS.Open("operation-name", adoConnection)

where operation-name is the name of a Server operation exposed by the service-name service, running on the default router (as specified in the registry).

If the operation requires arguments, before creating a RecordSet ADO object, you should create a Command object and then obtain a RecordSet from the Command:

Set aCommand = Server.CreateObject("ADODB.Command")
Set aCommand.ActiveConnection = adoConnection
Command.CommandText = "operation-name"
aCommand.Parameters("arg-name") = arg-value
Set RS = aCommand.Execute

What Parts of ADO Are Supported?

The provider supports the following schema tables:

Schema tables can be opened by the ADODB.Connection.OpenSchema method, using the enumerator specified in the parentheses.

The following table shows which data types are supported, together with the corresponding OSTC types:

ADO Enumerator Corresponding OSTC Enumerator
adBSTR ostc::string
adInteger ostc::int32
adBigInt ostc::int64
adSingle ostc::float
adDouble ostc::double

Use of ADO is subject to the following restrictions:

Accessing the ObjectStore Thin Client OLE DB Source Through ODBC

Since it is possible to build a bridge between any OLE DB provider and ODBC, you can use ODBC to create clients of ObjectStore Component Servers.

ISG Navigator/Bridge includes an ODBC driver for OLE DB data sources. It consumes OLE DB providers and allows ODBC applications to access any OLE DB data source. ISG Navigator/Bridge is distributed by ISG International Software Group (http://www.isgsoft.com ) and by Microsoft Corporation(http://www.microsoft.com/oledb/download/download.htm).

Download and install ISG Navigator/Bridge. Then you can configure it to access Component Servers through any ODBC client.

Retrieving Error Information

When an ADO method that accesses the Component Server causes an error, ADO returns a standard ADO error code or generates the error code E_FAIL, #80040005. The provider uses the error code to identify its internal error conditions. In either case, you can retrieve extended information about the generated error.

For example, this code attempts to open a database in an active server page:

On Error Resume Next
Set adoConnection = Server.CreateObject("ADODB.Connection")
Call adoConnection.Open(
      "provider=ObjectStore Thin Client OLE DB Provider;\
      datasource=testService","",""
)
if Err.Number <> 0 then
      Response.Write("Error# " & Hex(Err.Number) & "<BR>")
      Response.Write("Generated by: " & Err.Source & "<BR>")
      Response.Write("Description: " & Err.Description & "<BR>")
      Exit Sub
End If

If you are accessing OLE DB directly (that is, without using the ADO layer), you can retrieve information about the errors generated by the provider. Refer to Microsoft's OLE DB documentation for details.



[previous] [next]