Sybase
Sybase
___________________________________________________________________________________________________
Copyrights Reserved Page 1 of 8
INTRODUCTION TO OPEN CLIENT PROGRAMMING
Chapter Includes:
DB-Library Programming
ODBC
ODBC Interface
___________________________________________________________________________________________________
Copyrights Reserved Page 2 of 8
Essential pieces of a DB-library client
Each DB-Library program has a several essential pieces
Entry code
Opening a connection to the server
A message handler to process message from server
A message handler to process message from DB-library
Exit code
Entry Code:
This is the first step to initialize the library. In the introduction C registration is
more complex with the introduction of two callback functions.
Registration of the message and error handlers can occur at any time after
calling dbinit().
Opening a connection:
After initialization has done, it’s time to open a connection server. There are
25 connections by default
Microsoft's VBSQL object can manage up to 45 separate connection from a
single object by calling sqlsetmaxprocs().
When opening a connection to a server a login record is first allocated with in
your local library.
This login records holds several pieces of information relevant to the
connection which must be set inside of your application
Username
Password
Using print is common inside stored procedure to pass user defined messages
back to an application.
Error Handler:
The error handler receives errors from DB-Library. These errors may report
that an sql server cannot be found, or the connection has been broken, or that
not enough memory is available for a connection to be opened
Exit Code:
Ct-Library Programming:
Context:
___________________________________________________________________________________________________
Copyrights Reserved Page 4 of 8
Connections can also have properties many of which are unique to a
connection and do not relate the context.
Submitting a batch:
ODBC:
ODBC allows a single application to make a standard set of calls that are then
translated through the use of an ODBC driver, into statements on the target
data base management system.
It is also possible to use SQL pass through simply to quote to the server, SQL
statements that are passed without being altered by the driver.
Open Database Connectivity (ODBC) provides a standard software API
method for using database management systems (DBMS).
The goal of ODBC is to make it possible to access any data from any
application, regardless of which database management system (DBMS) is
handling the data.
___________________________________________________________________________________________________
Copyrights Reserved Page 5 of 8
ODBC manages this by inserting a middle layer, called a database driver,
between an application and the DBMS.
The purpose of this layer is to translate the application's data queries into
commands that the DBMS understands. For this to work, both the application
and the DBMS must be ODBC-compliant -- that is, the application must be
capable of issuing ODBC commands and the DBMS must be capable of
responding to them.
JDBC-ODBC bridges:
ODBC Interface:
Core API
Level 1 API
Level 2 API
Core API: A set of core functions that correspond to the functions in the X/Open
SQL Access Group Call Level Interface specification.
Level 2 API: Core and Level 1 API functionality plus all Level 2 functionality.
The Connect ODBC drivers support all Core and Level 1 functions. In addition,
each driver supports a key set of the Level 2 functions. For a list of supported
Level 2 functions by driver, refer to the "ODBC Conformance Levels" section for
the database you are connecting to in the Connect ODBC Reference.
___________________________________________________________________________________________________
Copyrights Reserved Page 7 of 8
1) What are the essential pieces of a DB-Library client?
Topics Covered:
DB Library programming
CT -Library Programming
by
Ray Rankins
Jeffrey R. Garbus
David Solomon
___________________________________________________________________________________________________
Copyrights Reserved Page 8 of 8