Tue Nov 27 2018

JDBC vs ODBC

Programming1288 views

JDBC vs ODBC

Database vendors, such as Microsoft and Oracle, implement their database systems using technologies that vary depending on customer needs, market demands, and other factors. Software applications written in popular programming languages, such as C, C++, and Java, need a way to communicate with these databases. Open Database Connectivity (ODBC) and Java Database Connectivity (JDBC) are standards for drivers that enable programmers to write database-agnostic software applications. ODBC and JDBC provide a set of rules recommended for efficient communication with a database. 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.

Let's see the differences between ODBC and JDBC.

ODBC

An ODBC uses the Open Database Connectivity (ODBC) interface by Microsoft that allows applications to access data in database management systems (DBMS) using SQL as a standard for accessing the data. ODBC permits maximum interoperability, which means a single application can access different DBMS. Application end users can then add ODBC database drivers to link the application to their choice of DBMS. Its design was predicated on the idea of making a function independent of programming languages, database systems and, operating systems.

JDBC

Java Database Connectivity (also known as JDBC) is an API that is used specifically for the Java programming language. It is used to define how a client may access a particular database. It also provides methods for querying and updating data in that particular database. The JDBC API is orientated specifically towards relational databases. It is part of the Java Standard Edition platform, from Oracle Corporation. Initially, the JDBC API was introduced as a part of the Java 2 Platform, SE version 1.1. Coupled with a reference implementation JDBC to ODBC bridge, this API was capable of enabling connections to any ODBC accessible data source on the JVM host environment.

JDBC vs ODBC

  • ODBC is procedural and JDBC is object-oriented.

  • ODBC is used to provide a connection between front-end application(other than Java) and back-end (database like ms-access). JDBC is used to provide connection between JAVA and database(Oracle,Sybase,DB2,ms-access).

  • JDBC is language dependent and it is Java specific, whereas the ODBC is a language independent.

  • ODBC is a function that provides a standard software API method to computers using DBMSs; JDBC is an API used for the Java programming language to define how a client may access a database.

  • ODBC implementations are run through multiple operating systems; JDBC implementations can exist and be used by the same application.

  • ODBC can't be directly used with Java because it uses a C interface.

  • ODBC is Microsoft drivers and uses dll files. On the other hand, JDBC is Java drivers and uses jar files.

  • ODBC makes use of pointers which have been removed totally from java.

  • JDBC is secured because it is written in a Java language while ODBC is a non-secured because it is written in C language.

  • JDBC is designed to keep things simple while allowing advanced capabilities when required. But ODBC mixes simple and advanced features together and has complex options for simple queries.

  • ODBC requires manual installation of the ODBC driver manager and driver on all client machines. In contrast, JDBC drivers are written in Java and JDBC code is automatically installable, secure, and portable on all platforms.

  • JDBC API is a natural Java Interface and is built on ODBC. JDBC retains some of the basic features of ODBC.

  • Java Database Connectivity enables Java programs to execute SQL statements. JDBC makes it possible to write a single database application that can run on different platforms and interact with different DBMS.

  • You can use ODBC for any language like C, C++, Java etc. On the other side, you can use JDBC only for Java languages.

  • You can use JDBC in any platform, whereas ODBC is only suitable for windows platform.

  • The code for ODBC is complex and is hard to learn. However, the code for JDBC is simpler, easy to understand and easy to run.




 

Lastly, we can say that both JDBC and ODBC are used from an application on the client side to access different types of the 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. Let us know which one is your choice. Thank you!

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.