Previous Page TOC Index Next Page



THEORY OF OPERATION


SOLID SQL API is the native call level interface of SOLID DBMS. SOLID SQL API is based on the SQL Access Group's CLI specification, a standard dynamic call level interface. The SQL syntax used in SOLID Server is based on the ANSI X3.135-1989 level 2 standard including important ANSI X3.135-1992 (SQL2) extensions. Developers have also the option of accessing SQL SQL API through ODBC API in the Windows (3.x, NT and 95) environments. ODBC provides a single interface for SQL queries to access a variety of relational and non-relational databases.

SAG CLI History

The SQL Access Group (SAG) was formed in 1989 to define and promote standards for database portability and interoperability. The group's initial projects involved developing the draft ISO/ANSI standard for SQL (including the embedded-SQL interface specifications) and a specification for remote data access (RDA).

In 1990, SAG took the lead in developing an SQL-based Call Level Interface (CLI). The SAG CLI is and API for database access, offering an alternative invocation technique to embedded SQL that provides essentially equivalent operations. SAG envisioned an interface that would enable client/server applications to access data stored in heterogeneous relational and nonrelational databases. The interface would be platform, vendor, database and language neutral. SAG and X/Open published the CLI Snapshot Specification in 1992 as a "work in progress", and it was adopted for use in commercial software products.

Microsoft helped to define the X/Open CLI specification and became the first company to commercialize the CLI specification by shipping ODBC 1.0 for Windows in 1992. To create ODBC, Microsoft extended the CLI specification and created a three-layer specification in which the "core" layer corresponds to the SAG CLI. Over the next two years, the CLI specification underwent several transformations, reemerging in 1994 as an X/Open Preliminary Specification. Also in 1994, Microsoft released ODBC 2.0, whose core functionality was still aligned with the SAG CLI. In 1996, Microsoft announced that ODBC 3.0 will be fully aligned with both ISO's CLI standard and SAG's CLI Specification.

SOLID SQL API

SOLID SQL API is a DLL for Windows and OS/2, and a library for other environents. SOLID SQL API has functions that support a rich set of database access operations sufficient to creating robust database applications, including:

A database application calls these functions for all interactions with a database. SOLID SQL API enables applications to establish multiple database connections simultaneously and to process multiple statements simultaneously.

Using SOLID SQL API

The application allocates memory for an environment handle and a connection handle; both are required to establish a database connection. The SQLConnect call establishes the database connection, specifying the server name, user id, and password. The application then allocates memory for a statement handle and calls either SQLExecDirect, which both prepares and executes an SQL statement, or SQLPrepare and SQLExecute, which allows statements to be executed multiple times. If the statement was a SELECT statement, the resulting columns need to be bound to variables in the application. This is done by using SQLBindCol. The rows can be then fetched using repeatedly SQLFetch.If the statement was a UPDATE, DELETE or INSERT, the application needs to check if the execution succeeded and call SQLTransact to commit the transaction. Finally the application closes the connection.

SOLID SQL API and ODBC Interface

The Open Database Connectivity (ODBC) interface allows applications to access data in database management systems (DBMS) using Structured Query Language (SQL) as a standard for accessing data.

The interface permits maximum interoperability — a single application can access different database management systems. This allows an application developer to develop, compile, and ship an application without targeting a specific DBMS. Users can then add modules called database drivers that link the application to their choice of database management systems.

Accessing SOLID SQL API through ODBC API

Native 16 and 32 bit ODBC drivers are available for maximum power and functionality. When SOLID SQL API is accessed through ODBC API developers can use also those ODBC functions that are implemented in the ODBC Driver Manager.


The ODBC interface can be used in Windows 3.x, Windows 95 and Windows NT clients.

ODBC History

In the traditional database world, application has usually meant a program that performed a specific database task with a specific DBMS in mind such as payroll, financial analysis, or inventory management. Such applications have typically been written using embedded SQL. While embedded SQL is efficient and is portable across different hardware and operating system environments, the source code must be recompiled for each new environment.

Embedded SQL is not optimal for applications that need to analyze data stored in databases such as DB2® and Oracle®, and prefer to do so from within a familiar application interface, such as a Microsoft Excel® spreadsheet. Under the traditional approach to database access, one version of Microsoft Excel would have to be precompiled with the IBM® precompiler and another with the Oracle precompiler, clearly a radical departure from simply buying a single packaged product.

ODBC offers a new approach: provide a separate program to extract the database information, and then have a way for applications to import the data. Since there are and probably always will be many viable communication methods, data protocols, and DBMS capabilities, the ODBC solution is to allow different technologies to be used by defining a standard interface. This solution leads to the idea of database drivers — dynamic-link libraries that an application can invoke on demand to gain access to a particular data source through a particular communications method, much like a printer driver running under Windows. ODBC provides the standard interface that allows both application writers and providers of libraries to shuttle data between applications and data sources.

ODBC Interface

The ODBC interface defines the following:

The interface is flexible:

To send an SQL statement, include the statement as an argument in an ODBC function call. The statement need not be customized for a specific DBMS.

ODBC Components

The ODBC architecture has four components:

The Driver Manager and driver appear to an application as one unit that processes ODBC function calls. The following paragraphs describe each component in more detail.

Application

An application using the ODBC interface performs the following tasks:

An application can provide a variety of features external to the ODBC interface, including mail, spreadsheet capabilities, online transaction processing, and report generation; the application may or may not interact with users.

Driver Manager

The Driver Manager, provided by Microsoft, is a dynamic-link library (DLL) with an import library. The primary purpose of the Driver Manager is to load drivers. The Driver Manager also performs the following:

Driver

A driver is a DLL that implements ODBC function calls and interacts with a data source.

The Driver Manager loads a driver when the application calls the SQLBrowseConnect, SQLConnect, or SQLDriverConnect function.

A driver performs the following tasks in response to ODBC function calls from an application:

Data Source

In this manual, DBMS refers to the general features and functionality provided by an SQL database management system. A data source is a specific instance of a combination of a DBMS product and any remote operating system and network necessary to access it.

An application establishes a connection with a particular vendor’s DBMS product on a particular operating system, accessible by a particular network. For example, the application might establish connections to:

Matching an Application to a Driver

One of the strengths of the ODBC interface is interoperability; a programmer can create an ODBC application without targeting a specific data source. Users can add drivers to the application after it is compiled and shipped.

From an application standpoint, it would be ideal if every driver and data source supported the same set of ODBC function calls and SQL statements. However, data sources and their associated drivers provide a varying range of functionality. Therefore, the ODBC interface defines conformance levels, which determine the ODBC procedures and SQL statements supported by a driver.

ODBC Conformance Levels

ODBC defines conformance levels for drivers in two areas: the ODBC API and the ODBC SQL grammar (which includes the ODBC SQL data types). Conformance levels help both application and driver developers by establishing standard sets of functionality. Applications can easily determine if a driver provides the functionality they need. Drivers can be developed to support a broad selection of applications without being concerned about the specific requirements of each application.

To claim that it conforms to a given API or SQL conformance level, a driver must support all the functionality in that conformance level, regardless of whether that functionality is supported by the DBMS associated with the driver. However, conformance levels do not restrict drivers to the functionality in the levels to which they conform. Driver developers are encouraged to support as much functionality as they can; applications can determine the functionality supported by a driver by calling SQLGetInfo, SQLGetFunctions, and SQLGetTypeInfo.

API Conformance Levels

The ODBC API defines a set of core functions that correspond to the functions in the X/Open and SQL Access Group Call Level Interface specification. ODBC also defines two extended sets of functionality, Level 1 and Level 2. The following list summarizes the functionality included in each conformance level.

Core API

Level 1 API

Level 2 API


Note Each function description in this manual indicates whether the function is a core function or a level 1 or level 2 extension function.

SQL Conformance Levels

ODBC defines a core grammar that roughly corresponds to the X/Open and SQL Access Group SQL CAE specification (1992). ODBC also defines a minimum grammar, to meet a basic level of ODBC conformance, and an extended grammar, to provide for common DBMS extensions to SQL. The following list summarizes the grammar included in each conformance level.

Minimum SQL Grammar

Core SQL Grammar

Extended SQL Grammar


Note In ODBC 1.0, positioned update, positioned delete, and SELECT FOR UPDATE statements and the UNION clause were part of the core SQL grammar; in ODBC 2.0, they are part of the extended grammar. Applications that use the SQL conformance level to determine whether these statements are supported also need to check the version number of the driver to correctly interpret the information. In particular, applications that use these features with ODBC 1.0 drivers need to explicitly check for these capabilities in ODBC 2.0 drivers.

For more information about data types, see Appendix D, "Data Types."

How to Select a Set of Functionality

The ODBC functions and SQL statements that a driver supports usually depend on the capabilities of its associated data source. Driver developers are encouraged, however, to implement as many ODBC functions as possible to ensure the widest possible use by applications.

The ODBC functions and SQL statements that an application uses depend on:

Because drivers support different levels of functionality, application developers may have to make trade-offs among the factors listed above. For example, an application might display the data in a table. It uses SQLColumnPrivileges to determine which columns a user can update and dims those columns the user cannot update. If some of the drivers available to the developer of this application do not support SQLColumnPrivileges, the developer can decide to:

Developers of specialized applications may make different trade-offs than developers of generalized applications. For example, the developer of an application that only transfers data between two DBMS’s (each from a different vendor) can safely exploit the full functionality of each of the drivers.

Connections and Transactions

Before an application can use ODBC, it must initialize ODBC and request an environment handle (henv). To communicate with a data source, the application must request a connection handle (hdbc) and connect to the data source. The application uses the environment and connection handles in subsequent ODBC calls to refer to the environment and specific connection.

An application may request multiple connections for one or more data sources. Each connection is considered a separate transaction space.

An active connection can have one or more statement processing streams.

A driver maintains a transaction for each active connection. The application can request that each SQL statement be automatically committed on completion; otherwise, the driver waits for an explicit commit or rollback request from the application. When the driver performs a commit or rollback operation, the driver resets all statement requests associated with the connection.

The Driver Manager manages the work of allowing an application to switch connections while transactions are in progress on the current connection.

Previous Page TOC Index Next Page

Copyright © 1992-1997 Solid Information Technology Ltd All rights reserved.