The differences and linkages between JDBC and ODBC in the Java series

Source: Internet
Author: User

Introduction to JDBC

JDBC (Java Data Base Connectivity,java database connection) is a Java API for executing SQL statements, which is one of the 13 specifications of Java. You can provide unified access to a variety of relational databases, consisting of a set of classes and interfaces written in the Java language. JDBC provides a benchmark to build more advanced tools and interfaces that enable database developers to write database applications, while JDBC is a trademark name.

Introduction to ODBC

Open database Interconnect (open databases Connectivity, ODBC osa take advantage of SQL To accomplish most of its tasks. ODBC itself also provides support for the SQL language, which allows users to send SQL statements directly to ODBC. Open Database Interconnect (ODBC) is the standard that Microsoft proposes for database access interfaces. Open Database Interconnect defines a specification for accessing database APIs that are independent of the different vendor's DBMS

the connection between the two

Both JDBC and ODBC are the initiators used to connect to the database, and JDBC and ODBC provide good support for access to heterogeneous databases on the Internet because of their database independence and even platform-independent nature.

The difference between the two

1.JDBC is easier to understand than ODBC

Programmers who work in programming know that Java is more studious than C, mainly because the Java language is object-oriented and closer to human thinking, and more easily accepted. and C language is more abstract, with people's understanding of the difference between the larger, the development of products have similar characteristics. In ODBC, a simple query, also requires a few pieces of content, and in the ODBC driver internal integration, do some complex operation. This not only reduces the performance of the database launcher, but also provides a definite negative effect for program developers to develop practical applications. While the JDBC database launcher in the design time contains most of the basic data manipulation functions, in order to write some general database operation statements, such as query, update, and so on, it requires much less source code than ODBC. Therefore, the JDBC database startup program is easier to understand than ODBC.

2.JDBC Database drivers are object-oriented

JDBC fully adheres to the good features of the Java language. Usually, as long as the Java function needs to design the basis of the user can in the shortest possible time to understand the JDBC driver architecture, easy to get started, can easily develop a strong database of practical application procedures. In the case of ODBC, because of its complex internal functions, the source code is required to write high. For this reason even a master of C language, still need to spend a lot of time to understand the database startup program, in the time of writing source code, but also inseparable from the relevant reference book.

3.JDBC is better for portability than ODBC.

Typically, after you install the ODBC driver, you need a certain configuration to apply. A different configuration cannot be common between different database servers. That is to say, install a demand configuration once. However, the JDBC database driver is not the same. If the JDBC database driver is used, only the appropriate JDBC database driver needs to be selected, and no additional configuration is required. During the installation process, the JDBC database driver completes its own configuration. For this reason, JDBC is better ported than ODBC.

excessive from ODBC to JDBC

Maybe the database program used to be ODBC driver, and if the database programming needs to use the JDBC driver now, then can there be a smooth transition? The answer is yes. There is a class called Jdbc-odbc Bridge Launcher in the JDBC driver. The JDBC database driver for this category is the bottom layer of the ODBC driver to connect to the database. If the original application is based on an ODBC database driver, or if the database does not help the corresponding JDBC driver, then database programming can be implemented using the JDBC-ODBC bridge driver. That is to say, the bridge driver can use the existing ODBC driver to access the contact database. Not only do they retain the previous development architecture (accessed via ODBC), they can also immediately apply Java as a new development environment, resulting in a smooth transition from ODBC database drivers to JDBC.

However, the need to pay attention to several difficulties when using this bridging driver. One is that the bridge driver still needs to use the ODBC database driver. Because the bridge driver directly contacts the ODBC driver, it then goes through the ODBC driver to access the database. To do this, the ODBC driver must be installed and configured first on the client. If you are using a three-tier development framework, you will also need to install the ODBC driver. Second, in this mode, the actual application of the program calls JDBC, and then through the JDBC call ODBC, and finally communicate with the database. Apparently there are a few more links between them. Because of its middle-link contest more, but the data access difficulties, it is not very good to check the difficulties. This is like a pipe, if the middle of the interface more, then in addition to the probability of water leakage is high. If there is really a leak, then the time to query the leak will also be difficult to compete. For this reason, I think the JDBC driver with bridging category is only expedient. At the right time, database development needs to be adjusted to the original development architecture, all of which go to the JDBC driver. The bridging program is just a time-out for database development. Although the pain in that transition is more painful, it is inevitable. Long pain is not as short as pain, the author of the opinion database development or early stop transition as well. And, in the case of estimation, the previous development architecture was also stopped to use the true JDBC driver.

Although JDBC is somewhat simpler and easier to understand than ODBC. But the existence of all things is reasonable, not to say that JDBC is good in all cases can use JDBC, there is no difference between the bad, but in a specific situation can choose the right way to implement. refer to Article http://blog.sina.com.cn/s/blog_4cf8aad30100lx47.html(seemingly blogger is translated, a lot of words used not very suitable, it is difficult to understand, I combine their own knowledge to do a little bit of personal understanding and collation, there are shortcomings please criticize correct.


The differences and linkages between JDBC and ODBC in the Java series

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.