What is OLE DB?
OLE DB API
OLE DB is a standard application programming interface (API)
developed by Microsoft. It is a component of Microsoft’s
Data Access Components software. OLE DB allows an application to
access a variety of data for which OLE DB data providers exist.
It provides an application with uniform access to data stored in
diverse formats, such as indexed-sequential files like Btrieve, personal
databases like Paradox, productivity tools such as spreadsheets
and electronic mail, and SQL-based
DBMSs.
The OLE DB interface supports direct connections to SQL-based databases.
Accessing data through OLE DB
Applications like PowerBuilder that provide an OLE DB interface
can access data for which an OLE DB data provider exists. An OLE
DB data provider is a dynamic link library (DLL) that
implements OLE DB function calls to access a particular data source.
The PowerBuilder OLE DB interface can connect to any OLE DB
data provider that supports the OLE DB object interfaces listed
in Table 4-1. An OLE
DB data provider must support these interfaces in order to adhere
to the Microsoft OLE DB 2.0 specification.
IAccessor |
IDBInitialize |
IColumnsInfo |
IDBProperties |
ICommand |
IOpenRowset |
ICommandProperties |
IRowset |
ICommandText |
IRowsetInfo |
IDBCreateCommand |
IDBSchemaRowset |
IDBCreateSession |
ISourcesRowset |
In addition to the required OLE DB interfaces, PowerBuilder also
uses the OLE DB interfaces listed in Table 4-2 to provide further functionality.
OLE DB interface |
Use in PowerBuilder |
---|---|
ICommandPrepare |
Preparing commands and retrieving column information. |
IDBInfo |
Querying the data provider for its properties. |
IDBCommandWithParameters |
Querying the data provider for parameters. |
IErrorInfo |
Providing error information. |
IErrorRecords |
Providing error information. |
IIndexDefinition |
Creating indexes for the extended attribute |
IMultipleResults |
Providing information. |
IRowsetChange |
Populating the extended attribute system |
IRowsetUpdate |
Creating the extended attribute system |
ISQLErrorInfo |
Providing error information. |
ISupportErrorInfo |
Providing error information. |
ITableDefinition |
Creating the extended attribute system
|
ITransactionLocal |
Supporting transactions. If this interface |
Accessing Unicode data
Using the OLE DB interface, PowerBuilder can connect, save,
and retrieve data in both ANSI/DBCS and Unicode databases
but does not convert data between Unicode and ANSI/DBCS.
When character data or command text is sent to the database, PowerBuilder sends
a Unicode string. The data provider must guarantee that the data
is saved as Unicode data correctly. When PowerBuilder retrieves character
data, it assumes the data is Unicode.
A Unicode database is a database whose character set is set
to a Unicode format, such as UTF-8, UTF-16, UCS-2, or UCS-4. All
data must be in Unicode format, and any data saved to the database
must be converted to Unicode data implicitly or explicitly.
A database that uses ANSI (or DBCS) as its character set might
use special datatypes to store Unicode data. Columns with these
datatypes can store only Unicode data. Any
data saved into such a column must be converted to Unicode explicitly.
This conversion must be handled by the database server or client.