In the JDBC process of learning the Java EE, the first to see JDBC immediately associated with ODBC, and we can be sure that they have a certain relationship. Start to learn it still feel a little dizzy, so I looked at a lot of data, and more familiar with the ODBC to compare.
Let's take a brief look at ODBC and JDBC.
ODBC(Open database Connectivity) is a set of standard APIs for database access that do most of the work through SQL, and it natively supports the SQL language to support the SQL that the user sends. ODBC defines a set of specifications that access the database APIs that are independent of the different DBMS and programming languages of actual performance.
That is, an ODBC-based application that operates on a database that does not rely on any DBMS, does not interact directly with the DBMS, and that all database operations are done by the corresponding DBMS's ODBC driver. Both SQL Server, Access, and Oracle databases can be accessed using the ODBC API.
Thus, the greatest advantage of ODBC is the ability to handle all databases in a unified manner .
jdbc(Javadatabase Connectivity) is the interface specification for Java and database, and JDBC defines a generic low-level API that supports standard SQL functionality, which is defined by the Java Languages are composed of classes and interfaces designed to allow database developers to provide standard database APIs for Java programmers.
The JDBC API defines a number of classes in Java that represent database connections, SQL directives, result sets, database metadata, and so on. It allows Java programmers to send SQL instructions and process the results.
In fact, JDBC and ODBC generally have more in common :
For example, JDBC and ODBC are x/open -based SQL Call-level interface;
Structurally speaking, the overall structure of JDBC is similar to odbc, both have four components: application, Driver Manager, driver, and data source working original the same principle;
< Span style= "line-height:26px" > In terms of content interaction, the JDBC maintains the basic characteristics of odbc also independent of a specific database and neither is &NBSP;&NBSP;
The difference between them:
we know that ODBC can connect almost all of the databases on almost all platforms. Why doesn't Java use ODBC? The answer is: Java can use ODBC, but preferably in the form of Jdbc-odbc Bridge (Java connection is generally divided into two forms of Java direct and Jdbc-odbc Bridge). then why do we need JDBC? because ODBC is not intended to be used directly in Java, it uses the C language interface. Calling local C code from Java has many drawbacks in terms of security, implementation, robustness, and automatic portability of programs. Literal translation from the ODBC C API to the Java API is undesirable. For example, Java does not have pointers, but ODBC has a wide range of pointers (including a very error-prone pointer "void *"). In addition, ODBC is more complex, while JDBC tries to ensure simplicity of simple functionality while allowing advanced functionality when necessary. If you use ODBC, you must manually install the ODBC Driver Manager and drivers on each client computer. If you write the JDBC driver completely in Java, the JDBC code can be automatically installed, ported, and secured on all Java platforms, from network computers to mainframes. in short, JDBC is largely based on the ODBC, developed from his foundation. JDBC retains the basic design features of ODBC, so programmers familiar with ODBC will find JDBC very easy to use. The biggest difference between them is that JDBC is based on Java style and benefits and is optimized for ease of use.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
ODBC vs. JDBC Comparison