Data Sources and Sessions

The following figure shows the classes that support connecting to and accessing a data source. Each class is based on a standard OLE DB component implementation.

Data Source and Session Classes

Data source and session classes

The classes are:

  • CDataSource   This class instantiates the data source object, which creates and manages a connection to a data source through an OLE DB provider. The data source takes information such as the data source address and authentication information in the form of a connection string.

    It is also worth noting that the helper class CEnumerator is often used before any connection is established to obtain a list of available providers registered on a system. This allows you to select a provider as a data source. For example, the Data Link Properties dialog box uses this class to populate the list of providers on the Providers tab. It is equivalent to the SQLBrowseConnect or SQLDriverConnect function.

  • CSession   This class instantiates the session object, which represents a single access session to the data source. However, you can create multiple sessions on a data source. For each session, you can create rowsets, commands, and other objects to access data from the data source. The session handles transactions.

See Also

Concepts

OLE DB Consumer Templates (C++)