Database Reference
In-Depth Information
Core API
Connect to data sources
Prepare and execute SQL statements
Retrieve data from a result set
Commit or roll back transactions
Retrieve error information
Level 1 API
Core API
Connect to data sources with driver-specific information
Send and receive partial results
Retrieve catalog information
Retrieve information about driver options, capabilities, and functions
Level 2 API
Core and Level 1 API
Browse possible connections and data sources
Retrieve native form of SQL
Figure 11-5
Summary of ODBC
Conformance Levels
Call a translation library
Process a scrollable cursor
application can be written to use higher-level conformance features if they are available and
to work around the missing functions if a higher level is not available.
For example, drivers at the Level 2 API must provide a scrollable cursor. Using confor-
mance levels, an application could be written to use cursors if they are available; but if they
are not, to work around the missing feature the application would select needed data using
very restrictive WHERE clauses. Doing this would ensure that only a few rows were returned
at a time to the application, and it would process those rows using a cursor that it maintained
itself. Performance would likely be slower in the second case, but at least the application would
be able to successfully execute.
SQL Conformance Level
ODBC SQL conformance levels specify which SQL statements, expressions, and data types a
driver can process. Three SQL conformance levels are defined, as summarized in Figure 11-6.
The capability of the minimum SQL grammar is very limited, and most drivers support at least
the core SQL grammar.
As with ODBC conformance levels, an application can call the driver to determine what
level of SQL conformance it supports. With that information, the application can then deter-
mine which SQL statements can be issued. If necessary, the application can then terminate
the session or use alternative, less-powerful means of obtaining the data.
Creating an ODBC Data Source Name
An ODBC data source is an ODBC data structure that identifies a database and the DBMS that
processes it. Data sources identify other types of data, such as spreadsheets and other nonda-
tabase tabular data stores, but we are not concerned with that use here.
The three types of data sources are file, system, and user. A file data source is a file
that can be shared among database users. The only requirement is that the users have
the same DBMS driver and privilege to access the database. The data source file can be
e-mailed or otherwise distributed to possible users. A system data source is one that is
local to a single computer. The operating system and any user on that system (with proper
 
Search WWH ::




Custom Search