SARAHRACHELSSIT2020
2 views
14 slides
Oct 15, 2025
Slide 1 of 14
1
2
3
4
5
6
7
8
9
10
11
12
13
14
About This Presentation
Java
Size: 220.26 KB
Language: en
Added: Oct 15, 2025
Slides: 14 pages
Slide Content
ODBC and JDBC
ODBC
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.
ODBC Open Database Connectivity (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.
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.
Driver Manager A Driver 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.
DSN A Data Source Name (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: Applications select a DSN by name (e.g., "My Local MySQL"). The DM retrieves the connection details stored in that DSN. If any information is missing (e.g., a password), the DM prompts the user to provide it at runtime.
Bridges used in ODBC 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.
Advantages: Centralized Configuration Ease of Use for Developers Standardization Across Databases Runtime Flexibility
JDBC
JDBC drivers are 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.