JDBC and ODBC, both are the API (Application Programming Interface) that help the applications on the client side to access the database on the server side. The RDBMS vendors provide ODBC or JDBC drivers so that their database can be accessed by the applications on client side.
The point that fundamentally differentiates JDBC and ODBC is that JDBC is language dependent and it is Java specific whereas, the ODBC is a language independent. Let us see in how many aspects the does JDBC and ODBC differs from each other with the help of comparison chart shown below.
Content: JDBC Vs ODBC
Comparison Chart
Basis for Comparison | JDBC | ODBC |
---|---|---|
Basic | JDBC is language and platform dependent (Java Specific). | ODBC is language and platform independent. |
Full form | Java Database Connectivity. | Open Database Connectivity. |
Code | Code is easy to understand. | Code is complex. |
Definition of JDBC
Java Database Connectivity (JDBC) is an application programming interface i.e. (API). JDBC was released as a part of Java development Kit (JDK) 1.1. in the year 1996 by SUN Microsoft. It is built the basis of ODBC and hence, some basics of ODBC retain in JDBC.
It is a standard interface between any Java application and different databases. The function of JDBC is to help the Java-based application to access different types of databases. JDBC provide methods to query database, and it can also be used to update the database. JDBC provide JDBC drivers that converts the request from Java application on client side to the language that database understands.
As JDBC is language and platform specific, Java application can use JDBC-to-ODBC bridge to communicate with ODBC adaptable databases. Unlike ODBC, JDBC has easy coding but, it is only limited to Java only.
Definition of ODBC
ODBC is Open Database Connectivity. Like JDBC, ODBC is also an API that acts as an interface between an application on the client side and the database on the server side. Microsoft introduced ODBC in the year 1992.
ODBC helps an application to access the data from the database. An application written in any language can use ODBC to access different types of databases and hence, it is said to be language and platform independent. Like JDBC, ODBC aslo provides ODBC drivers that convert the request of application written in any language into the language understandable by databases.
ODBC is most widely used and understands many different programming languages. But its code is complex and hard to understand.
Key Differences Between JDBC and ODBC
- The most basic difference between JDBC and ODBC is that JDBC is language and platform dependent. On the other hand, the ODBC is language and platform independent.
- Java Database Connectivity is an acronym for JDBC, and on the other hand, Open Database Connectivity is an acronym for ODBC.
- The code for ODBC is complex and is hard to learn. However, the code for JDBC is simpler and easy to run.
Similarity
Both are used by the client-side applications to access different kinds of databases on server side.
Conclusion
Both JDBC and ODBC are used from an application on the client side to access different types of database on the server side. If you want to platform and language independent then use ODBC else if you are working on Java platform then use JDBC.
BKdam says
Thank you very much for this clear explanation!!
Retko says
Hi,
what does it mean that JDBC is platform dependent (on Java)?
Thanks
Retko says
Hi again,
why I can’t use ODBC for everything, even Java applications? Is there a difference is some speed etc.?
Thanks
MJ says
The information is finite 🙂
prakash says
Thanks for the information
Russ says
Good article. Thanks,