ODBC and JDBC

ODBC (Open Database Connectivity) and JDBC (Java Database Connectivity) serve as APIs for a program to interact with a database server.

In general, the application must make calls to:

  1. connect with the database server

  2. send SQL commands to the database server

  3. fetch tuples of result one-by-one into program variables

ODBC

ODBC works with C, C++, C# and Visual Basic (other APIs such as ADO.NET sit on top of ODBC).

ODBC is the standard for application programs communicating with a database server.

The API will:

  1. open a connection with a database

  2. send queries and updates

  3. get back results

ODBC can be used with applications such as GUIs, spreadsheets etc.

JDBC

JDBC works with Java.

Along with supporting various features for querying and updating data, and for retrieving query results, JDBC also supports metadata retrieval i.e. retrieving information about the database such as relations present in the database and the names and types of relation attributes.

JDBC connects with the database as follows:

  1. open a connection

  2. create a “Statement” object

  3. execute queries using the Statement object to send queries and fetch results

  4. exception mechanism to handle errors

Last updated