ODBC (open database connectivity) is an open specification given by x-open company that contains a set of rules and guidelines to develop ODBC drivers for different.
The most common approach to maintain the application data is to store in database, which requires applications to communicate with a database.
Problems with accessing a database:
1. Application becomes vendor dependent.
2. The application may not be able to collaborate with the database as the vendor specific protocol may not be available for programming language used to develop the application.
3. While developing an application for personal computers you need to write data access routine for each different database, which increases the development time and cost.
The problems can be solved by generic API to communicate with different database. So, we can use ODBC, which provides standard abstraction for different databases, to solve these problems.
• ODBC is open standard API used to access databases and was developed by Microsoft in collaboration with IBM and other database vendors. It's an interface that allows the application to access database.
• ODBC provides a uniform method to access different databases. ODBC was the need to develop generic and interoperable applications.
• ODBC consists of the DriverManager (DM) and ODBC drivers. The DriverManager locates the names of the drivers and then loads the specific driver for the database. The ODBC driver is a shareable object used to implement the ODBC interface on a database.
Features of ODBC
The features of ODBC are generally based upon the level of conformance. There are 3 basic levels: Core, Level1, Level2. Level 2 is the most commonly used conformance level in the ODBC platform. Main features of ODBC are as follows:
1. Standard SQL syntax
2. Standard error codes
3. Rich metadata
4. Many attributes and options
Components of ODBC
ODBC contains four main components:
I. Application Component
This component processes application-specific operations, making calls to a database. The database is then able to process the requests made by the application and return the results.
II. DriverManager Component
DriverManager is one of the main components of ODBC architecture. The DriverManager component provides a standard approach to load and unload drivers.
Problems like determining which driver to load and loading and unloading drivers are solved by DriverManager Component.
III. Driver Component
This application performs application-specific OOBC function calls and is loaded in the application by the DriverManager. It processes the function calls made by the application that wants to communicate with the database.
IV. Datasource Component
This is the data source that is stored in the system or file that consists of information about the related databases, operating system and network policy used to connect to the database.
In ODBC architecture, you can have multiple drivers and data sources which allow an application to access the data from multiple sources.
ODBC API is used as an interface between the application and the drivers.
In the figure, application program receives user requests and sends these requests to the DriverManager to process the user requests. This then connects to the database and also loads the driver to the process the user requests. There are two types of ODBC architectures:
(a) Single-tier Architecture
(b) Multiple-tier Architecture
I. Single-tier Architecture
In this architecture, the driver directly interacts with the database. The driver receives the user requests using SQL statements and retrieves the results according to these SQL statements.
Here the ODBC drivers interact directly with the database file. It does not require any database server or support layer to access the data from the database.
II. Multiple-tier Architecture
In this architecture, the driver sends the SQL request to the server. Therefore, the multiple-tier architecture is based on the client-server mechanism. The Application, Driver and DriverManager are collectively called CLIENT, whereas the database and software that control the access to the database and reside in the computer are collectively called Server.