DataSourcesOleDB


Supported with:
  • Engine
  • ArcView
  • ArcEditor
  • ArcInfo
  • Server
Library dependencies: System, SystemUI, Geometry, Display, Server, Output, Geodatabase, GISClient, DataSourcesFile, DataSourcesGDB

Additional library information: Contents, Object Model Diagram

The DataSourcesOleDB library contains the implementation of the GeoDatabase application programming interface (API) for the Microsoft Object Linking and Embedding database (OLE DB) data sources and text file data sources. These data sources include any OLE DB supported data provider and text file workspaces.
 
The DataSourcesOleDB library is not extended by developers. It is only available on the Microsoft Windows operating system.

See the following sections for more information about this namespace:

OleDBWorkspaceFactory and TextFileWorkspaceFactory

A workspace factory object is a dispenser of workspaces and allows a client to connect to a workspace specified by a set of connection properties. A workspace represents a database or a data source that contains one or more datasets. Examples of datasets include tables and feature classes. DataSourcesOleDB has workspace factories for connecting to OLE DB and text file data sources. See the following illustration of the OLE DB data source objects:
Workspace factories are cocreatable, singleton objects. (A singleton object can only be instantiated once in a process.) Each workspace factory maintains a pool of currently connected, active workspaces that are referenced by the application. Connection properties are specified using a PropertySet object and can be saved to a connection file.
See the following code example that shows how to open a table from an OLE DB data source:
[Java]
//Create and populate a new property set.
PropertySet propset = new PropertySet();
propset.setProperty("CONNECTSTRING", 
    "Provider=MSORCL32.1;Data source=mydatabase;User ID=gdb;Password=gdb");
//Create a new OleDB workspacefactory and open the OleDB workspace.
OLEDBWorkspaceFactory workspaceFactory = new OLEDBWorkspaceFactory();
IFeatureWorkspace featWorkspace = (IFeatureWorkspace)workspaceFactory.open(propset,
    0);
//IFeatureWorkspace featWorkspace = workspaceFactory.open(propset, 0);
//Open a table object.
ITable table = featWorkspace.openTable("GDB.MY_TABLE");
  • The following code example shows how to open a table from a TextFile data source:
[Java]
//Create a new textfile workspacefactory and open a textfile workspace.
TextFileWorkspaceFactory workspaceFactory = new TextFileWorkspaceFactory();
IFeatureWorkspace featWorkspace = (IFeatureWorkspace)workspaceFactory.openFromFile(
    "./", 0);
//Open a table object.
ITable table = featWorkspace.openTable("Sample.txt");