- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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. | Key | ODBC | JDBC |
---|---|---|---|
1 | Stands For | ODBC 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. |
2 | Introduction | ODBC was introduced by Microsoft prior to JDBC in 1992. | JDBC was introduced by SUN MicroSystems after ODBC in 1997. |
3 | Platform dependency | ODBC 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. |
4 | Type | ODBC 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. |
5 | Performance | The 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( "jdbc:mysql://localhost:3306/'yourDBname'","username","userpassword"); Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery("select * from emp"); while(rs.next()) System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "+rs.getString(3)); con.close(); } catch(Exception e){ System.out.println(e);} } }
- Related Articles
- Difference Between JDBC and ODBC
- Difference between ODBC and JDBC in Java
- What is the difference between the TYPE_SCROLL_INSENSITIVE and TYPE_SCROLL_SENSITIVE ResultSets in JDBC?
- What is the difference between execute(), executeQuery() and executeUpdate() methods in JDBC?
- What is ODBC?
- Difference Between JDBC and Hibernate
- What is the difference between the methods setBlob() and setBinaryStream() which is preferable in JDBC?
- Explain the difference between RowSet and ResultSet in JDBC?
- Disabling JDBC/ODBC access to SAP HANA system for a new user
- What are the features of ODBC?
- What are the important components of ODBC?
- What are the disadvantages of ODBC drivers?
- What is JDBC?
- What is Host, and what is the difference between Nutrients and Nutrition?
- What is the difference between Java and JavaScript?

Advertisements