Open Database Connectivity-: Open Database Connectivity (ODBC)is a widely accepted application programming interface for database access. ODBC is designed for maximum interoperability as like the ability of a single application to access different database management system with the same source code. DBMS application call functions in the ODBC interface which are implemented in database specific modules called drivers. The function in the ODBC API are implemented by developer of dbms specific drivers. Application call the function in these drivers to access data in a dbms independent manner.
The ODBC API is used in two place between the application and the driver manager and other one is between the driver manager and other drivers.
The ODBC architecture has four components….
- Application- Perform processing and calls ODBC function to submit sql statement and retrieve results.
- Driver Manager – Loads and unloads drivers on behalf of an application process ODBC function calls or passes them to a driver.
- Driver-: Process ODBC function calls submits sql request to a specific data source and returns results to the application . If necessary the driver modifies an application request conforms to syntax supported by the associated DBMS.
- Data Source- Consists of the data the user wants to access and its associated operating system DBMS and network platform used to access the DBMS.
Applications – An application is a programme the call the ODBC API to access data. a number of tasks are common to all application no matter how they use ODBC taken together they largely define the flow of ODBC application . The task are
- Selecting a data source and connecting to it.
- Submitting a SQL statement for execution.
- Retrieve the result
- Processing the error
- committing or rolling back the transaction enclosing the sql statement
- Disconnecting from the data source.
Because most data access work is done by sql. The primary task for which application use ODBC is to submit sql statement and retrieve the result generated by those statement. Other task for which application use ODBC include determining and adjusting to driver capability and browsing the database .
Driver Manager-: Driver Manager is a library that manage communication between application and driver. The driver manager exists mainly as a convenience to application writers and solves a number of problems common to all application . These include determining which driver to load based on a data source name loading and unloading drivers and calling function in drivers.
The application is linked to the driver manager and calls ODBC function in the driver manager not the driver the application identifies the target driver and data source with a connection handle. When it loads a driver the driver manager builds a table of pointers to the function in that driver It uses the connection handle passed by the application to find the address of the function in the target drivers and calls the function by address.
For the most part driver manager just passes function calls from the application to the correct drivers. However It also implements some functions as like SQL data sources,SQL drivers and SQL get function etc. and perform basic error checking.
The final major role of the driver manager is loading and unloading drivers. the application loads and unloads only the driver manager . when it wants to use a particular driver it calls a connection function. in the driver manager and specific the name of a particular data source or driver such as ‘Accounting’ or ‘SQL Server’ Using this name the driver manager searches the data source information for the driver file name such as a sqlserver.dll. It then loads the driver store the address of each function in the driver and calls the connection function in the driver which then initilizes itself and connect to the data source.
When the application is done using the driver It calls SQL Disconnect in the driver manager. The driver manager calls the function in the driver which disconnects from the data source . however the driver manager keeps the driver in memory in case the application reconnect to it. It unloads the driver only when the application frees the connection used by the driver or uses the connection fro a different driver and no other connection use the driver for example a complete description of the driver manager role loading and unloading driver.
Drivers- : Drivers are library that implemented the function in the ODBC . Each specific to a particular DBMS As like a driver for Orcal cannot directly access data in DB 2 .Driver expose thee capability of the underlying DBMS’s. The driver performs following task…
- Connecting and disconnecting from data source.
- Checking the function error and driver manager not checked the function error.
- Initiating transaction meas this is a transparent to the application.
- Submitting the sql statement to the data source for execution. The driver must modifying ODBC SQL to DBMS specific SQL.
- Sending data and retrieve data from data source.
- Mapping DBMS specific error to ODBC SQL statements.
Data Source-: A data source is a simply the source of the data. It can be a file a particular database on a dbms or even a live data feed. the data might be located on the same computer as the programme or an another computer somewhere on a network. The purpose of data source is together all of the technical information needed to access the data the driver name network address network software and so on into a single place and hide it from the user.