APPLICATION PROGRAMMING INTERFACE
An application programming interface (API) is a connection between computers or
between computer programs.
It is a type of software interface, offering a service to other pieces of software.
In contrast to a user interface, which connects a computer to a person, an application
programming interface connects computers or pieces of software to each other.
One purpose of APIs is to hide the internal details of how a system works, exposing
only those parts a programmer will find useful and keeping them consistent even if the
internal details later change. An API may be custom-built for a particular pair of
systems, or it may be a shared standard allowing interoperability among many systems.
When used in the context of web development, an API is typically defined as a set of
specifications, such as Hypertext Transfer Protocol (HTTP) request messages, along
with a definition of the structure of response messages, usually in an Extensible
Markup Language (XML) or JavaScript Object Notation (JSON) format.
4.
ODBC
Open DatabaseConnectivity (ODBC) is a standard application programming
interface (API) for accessing database management systems (DBMS).
ODBC accomplishes DBMS independence by using an ODBC driver as a translation
layer between the application and the DBMS.
The application uses ODBC functions through an ODBC driver manager with which it
is linked, and the driver passes the query to the DBMS.
An application that can use ODBC is referred to as "ODBC-compliant".
Any ODBC-compliant application can access any DBMS for which a driver is
installed.
Drivers exist for all major DBMSs, many other data sources like address book systems
and Microsoft Excel, and even for text or comma-separated values (CSV) files.
5.
ODBC Drivers
Connection Management:
ODBC drivers handle tasks like locating and connecting to the DBMS.
They support authentication and session initiation, ensuring the application can
establish and terminate connections effectively.
SQL Command Translation and Execution:
SQL statements from the application are passed to the ODBC driver, which
translates them into a form understood by the DBMS.
If certain SQL features are unsupported by the DBMS, the driver can
emulate them.
Data Conversion:
ODBC drivers map the DBMS's proprietary data types into standardized
ODBC data types, which are based on C language formats.
This ensures consistent data handling across different databases.
6.
Driver Manager
ADriver Manager is a special software layer that manages ODBC drivers and enhances
their functionality. It acts as an intermediary between applications and database drivers,
ensuring seamless communication.
The DM can identify all installed ODBC drivers on a system. It often presents this
information in a list, typically via a GUI (Graphical User Interface). For example, it can
show a list of drivers for databases like MySQL, Oracle, and PostgreSQL.
7.
DSN
A Data SourceName (DSN) is a configuration that stores connection details for a specific
database. DSNs are critical for making ODBC connections user-friendly and reusable.
Different instances of the same database software (e.g., MySQL) may require different
connection details.
Includes Driver Name, Server Information, Database Name, Authentication Details, Port
and Protocols.
Connection Management Using DSNs
The DM uses DSNs to streamline the process of connecting to databases:
1. Applications select a DSN by name (e.g., "My Local MySQL").
2. The DM retrieves the connection details stored in that DSN.
3. If any information is missing (e.g., a password), the DM prompts the user to provide it
at runtime.
8.
Bridges used inODBC
ODBC-to-JDBC (ODBC-JDBC) bridges
An ODBC-JDBC bridge consists of an ODBC driver which uses the services of
a JDBC driver to connect to a database. This driver translates ODBC function-calls into
JDBC method-calls. Programmers usually use such a bridge when they lack an ODBC
driver for some database but have access to a JDBC driver.
JDBC-to-ODBC (JDBC-ODBC) bridges
A JDBC-ODBC bridge consists of a JDBC driver which employs an ODBC driver to
connect to a target database. This driver translates JDBC method calls into ODBC
function calls. Programmers usually use such a bridge when a given database lacks a
JDBC driver, but is accessible through an ODBC driver
OLE DB-to-ODBC bridges
An OLE DB-ODBC bridge consists of an OLE DB Provider which uses the services of
an ODBC driver to connect to a target database. This provider translates OLE
DB method calls into ODBC function calls. Programmers usually use such a bridge
when a given database lacks an OLE DB provider, but is accessible through an ODBC
driver.
JDBC driversare client-side adapters (installed on the client machine, not on the
server) that convert requests from Java programs to a protocol that the DBMS can
understand.
Types
Commercial and free drivers provide connectivity to most relational-database servers.
These drivers fall into one of the following types:
• Type 1 that calls native code of the locally available ODBC driver.
• Type 2 that calls database vendor native library on a client side. This code then talks to
database over the network.
• Type 3, the pure-java driver that talks with the server-side middleware that then talks to
the database.
• Type 4, the pure-java driver that uses database native protocol.