# What is the difference between ODBC and JDBC

Both ODBC and JDBC are the programming interface that is required by the applications at the client side to access the database at server side. Basically both are known as drivers to get connected with a database and are provided by the vendors of RDBMS.

The following are the important differences between ODBC and JDBC.

Sr. No.KeyODBCJDBC
1Stands ForODBC stands for Open Database Connectivity which literally means that it is compatible with all types of languages such as C, C++, Java, etc.JDBC Stands for Java database connectivity i.e only compatible with java language.
2IntroductionODBC was introduced by Microsoft prior to JDBC in 1992.JDBC was introduced by SUN MicroSystems after ODBC in 1997.
3Platform dependencyODBC is platform dependent as we can use ODBC only for windows platform.On the other hand, JDBC is platform-independent and can be used for any platform.
4TypeODBC can be considered as a type of procedural as most of these drivers are developed in a native languages like C and C++ which are the procedural types of language.On the other hand, JDBC is a purely object-oriented type driver.
5PerformanceThe performance of ODBC is faster as compared to JDBC as data imports and exports are faster and memory-intensive.On the other hand performance of JDBC is slower than native ODBC but its platform independence allowing to work with any operating system (including Mac and Linux), driver version, or bitness (32-bit or 64-bit).

## Example of ODBC vs JDBC

ODBC connection in c#

using System;
using System.Windows.Forms;
using System.Data.Odbc;
namespace WindowsApplication1{
public partial class Form1 : Form{
public Form1(){
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e){
string connetionString = null;
OdbcConnection cnn ;
connetionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=yourdatabasename.mdb;";
cnn = new OdbcConnection(connetionString);
try{
cnn.Open();
MessageBox.Show ("Connection Open ! ");
cnn.Close();
}
catch (Exception ex){
MessageBox.Show("Can not open connection ! ");
}
}
}
}

## Example

JDBC connection in java

import java.sql.*;
class JavaTester{
public static void main(String args[]){
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection(
}