ODBC ODBC INTRODUCTION INTRODUCTION BY : BY : SHACHAR SHACHAR ROSENBERG ROSENBERG GAL BITTON GAL BITTON
ODBC ODBC INTRODUCTIONINTRODUCTION
BY :BY :
SHACHAR ROSENBERGSHACHAR ROSENBERG
GAL BITTONGAL BITTON
TopicsTopics: :
ODBC overviewODBC overview HistoryHistory What is ODBCWhat is ODBC ODBC architectureODBC architecture The ODBC SolutionThe ODBC Solution
ODBC overviewODBC overview
ODBC stands for - ODBC stands for -
Open Database ConnectivityOpen Database Connectivity ODBC is an API introduced by Microsoft ODBC is an API introduced by Microsoft
that allows applications to access that allows applications to access databases by using SQLdatabases by using SQL
Purpose - the ability of a single Purpose - the ability of a single application to access different DBMSapplication to access different DBMS
(database management system)(database management system) with the same source code with the same source code
History –why was ODBC History –why was ODBC createdcreated? ?
Companies :Companies : A single DBMS applicationsA single DBMS applications Acquiring of different DBMSsAcquiring of different DBMSs Reasons :Reasons : - what was cheapest and fastest - what was cheapest and fastest - what they already knew - what they already knew - what was latest in the market- what was latest in the market - what worked best for a single - what worked best for a single
applications applications
Clients :Clients :
The advent of personal computers.The advent of personal computers. Different tools for querying ,analyzing , Different tools for querying ,analyzing ,
and displaying dataand displaying data The advent of client/server computingThe advent of client/server computing
Software vendors :Software vendors :
Usually wrote one DBMS-specific code Usually wrote one DBMS-specific code for each DBMS they wanted to accessfor each DBMS they wanted to access
Maintaining data access routines and Maintaining data access routines and applicationsapplications
Applications were sold not on there Applications were sold not on there quality but on whether they could access quality but on whether they could access data in a given DBMS data in a given DBMS
What all those group needed was :What all those group needed was :
* A way to access data in different DBMSs* A way to access data in different DBMSs
* A way to merge data from different * A way to merge data from different DBMSs in a single applicationDBMSs in a single application
* The ability to write a single application * The ability to write a single application that was independent of any one DBMSthat was independent of any one DBMS
They needed interoperable way to They needed interoperable way to access data :access data :
Open Database Connectivity - ODBC Open Database Connectivity - ODBC
What is ODBCWhat is ODBC? ?
Many misconceptions exist about ODBC :Many misconceptions exist about ODBC : End users see it as an icon in the control End users see it as an icon in the control
panelpanel Programmers see it as a library Programmers see it as a library
containing data access routinescontaining data access routines Others see it as the answer to all Others see it as the answer to all
database access problems ever database access problems ever imagined.imagined.
ODBC isODBC is : : A specification for a database APIA specification for a database API This API is independent of any one This API is independent of any one
DBMS, operating system or languageDBMS, operating system or language API’s functions are implemented by API’s functions are implemented by
developers of DBMS-specific driversdevelopers of DBMS-specific drivers Applications call this drivers functionsApplications call this drivers functions to access data in a DBMS-independent to access data in a DBMS-independent
mannermanner A Driver Manager manages A Driver Manager manages
communication between applications and communication between applications and drivers.drivers.
Developing :Developing :
Microsoft provides a Driver Manager for Microsoft provides a Driver Manager for computer running windows 95 and latercomputer running windows 95 and later
Although Microsoft has written several Although Microsoft has written several ODBC drivers and applications, today ODBC drivers and applications, today most of them are written by other most of them are written by other companies ,and some of them exist on companies ,and some of them exist on the Macintosh and a variety of UNIX the Macintosh and a variety of UNIX platformsplatforms
Microsoft offers an ODBC Software Microsoft offers an ODBC Software Development kit to help applications and Development kit to help applications and drivers developers drivers developers
ODBC is designed to expose database ODBC is designed to expose database capabilities , capabilities , notnot supplement them supplement them
ODBC ARCHITECTURE
Applications
• Generic applications
• Vertical applications
• Custom applications
Driver Manager
Loads and unloads drivers on behalf of an application. Processes ODBC function calls or
passes them to a driver.
Drivers • Connecting to and disconnecting from the data source . • Checking for function errors not checked by the Driver
Manager . • Initiating transactions; this is transparent to the
application . • Submitting SQL statements to the data source for
execution. The driver must modify ODBC SQL to DBMS- specific SQL.
• Sending data to and retrieving data from the data source, including converting data types as specified by the
application .
Data Sources
ProgramProgram calls an ODBC function.
ODBC ManagerODBC Manager determines what to do.
ODBC DriverODBC Driver performs actual processing.
DatabaseFile
The database file is opened by the driver and data is manipulated.
ODBC model 1:
ODBC model 2 :ODBC model 2 :
Client
Server
ProgramProgram calls an ODBC function.
ODBC ManagerODBC Manager determines what to do.
ODBC DriverODBC Driver prepares the request and passes it on to the DBMS.
DatabaseFile
The DBMS processes the request.
DBMSServer
The ODBC SolutionThe ODBC Solution
Requirements :Requirements :
1.Application must be able to access 1.Application must be able to access multiple DBMSs using the same source multiple DBMSs using the same source code without recompiling or relinking.code without recompiling or relinking.
2.Applications must be able to access 2.Applications must be able to access multiple DBMSs simultaneously. multiple DBMSs simultaneously.
Solution :Solution :
A different driver is required for each A different driver is required for each DBMS that supports ODBCDBMS that supports ODBC
The driver implements the functions in the The driver implements the functions in the ODBC APIODBC API
To use a different driver the application To use a different driver the application simply loads the new driver and call the simply loads the new driver and call the functions in itfunctions in it
To access multiple DBMSs simultaneously, To access multiple DBMSs simultaneously, the application needs to load multiple the application needs to load multiple drivers drivers
Which DBMS features should ODBC expose ?Which DBMS features should ODBC expose ?
Options :Options :
Common DBMS features Common DBMS features little use little use All DBMSs featuresAll DBMSs features impossible for impossible for
drivers to implement drivers to implement
Solution :Solution : ODBC exposes a significant number of ODBC exposes a significant number of DBMS features but does not require DBMS features but does not require
drivers to support all of them but only a drivers to support all of them but only a subset of those features.subset of those features.
The remaining features are implement The remaining features are implement usually only by drivers which supported usually only by drivers which supported by their underlying DBMS. by their underlying DBMS.
ODBC provide two functions for ODBC provide two functions for application to determine what features a application to determine what features a driver and DBMS supports : driver and DBMS supports :
-SQLGetInfo -SQLGetInfo general information general information -SQLGetFunctions -SQLGetFunctions supported functions supported functions
Questions ?Questions ?