# 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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://vikram-bajaj.gitbook.io/cs-gy-6083-principles-of-database-systems/main-1/sql/advanced-sql/accessing-sql-from-a-programming-language/odbc-and-jdbc.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
