Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What's the difference between JDBC and ODBC?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you what is the difference between JDBC and ODBC, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

When it comes to the difference between JDBC and ODBC, JDBC and ODBC are actually initiators used to connect to the database. ODBC, whose Chinese name is Open Database Interconnection, is a part of the database in the open service structure developed by Microsoft technicians. it establishes a set of related specifications and provides a set of standard application programming interfaces for database access. To put it simply, ODBC is a tool for applications to interact with database systems. An application program given to ODBC does not depend on the personnel's database system and does not support dealing with the database management system. All database operations are completed by the ODBC driver of the corresponding database system. Thus it is possible to deal with all databases in the same way.

JDBC, like ODBC, is also an intermediary for applications to communicate with the database. It's just that their developers are different. JDBC is provided by Sun to relational database system manufacturers with JDBC specifications and requirements; then major manufacturers follow the standard specifications to design JDBC drivers in line with their own database products. Although both JDBC and ODBC can implement similar functions, their development architectures are different and their implementation details are also different. For this reason, the database administrator must understand the differences in this aspect and choose the appropriate database driver according to the actual situation in his work.

The difference between JDBC and ODBC: the advantages of JDBC.

JDBC API is a program development interface for data access in JAVA programming language, which is composed of many classes and interfaces. ODBC is developed by the C language. Due to the difference between the two development platforms, the respective characteristics of different kinds of development are transferred to the database startup program. According to the author's understanding, compared with the ODBC database startup program, JDBC has the following advantages. If the author's summary is not comprehensive enough, you are welcome to complete it.

1. JDBC is easier to understand than ODBC. Those of you who have learned programming may have an intuitive feeling that JAVA is much easier to learn than C. Because the design idea of JAVA language is object-oriented, which is close to people's cognitive thinking, it is easier to be accepted and easier to learn. On the other hand, C language is more abstract and has a certain distance from the law of human cognition. For this reason, the products they have developed have similar characteristics. In ODBC, although it is possible to interact with the database, it is more complex to implement. For example, a simple query also needs to be divided into several pieces of content, while it is integrated within the ODBC driver to perform some complex operations. This not only reduces the performance of the database startup program, but also brings some negative effects to the program developers to develop applications. The JDBC database startup program contains most of the basic data operation functions when it is designed, so when writing some conventional database operation statements, such as query, update and so on, it requires much less code than ODBC. Therefore, in this respect, the JDBC database launcher is easier to understand than ODBC.

2. JDBC database driver is object-oriented and completely follows the excellent characteristics of JAVA language. In general, as long as there is a JAVA car function to design the basis of the user can understand the architecture of the JDBC driver in the shortest time, relatively easy to use, can easily develop a strong database application. As for ODBC, because of its complex internal functions, the coding requirements are high. To this end, even a C language master, still need to spend a lot of time to understand this database startup program; when writing code, it is inseparable from the relevant reference books.

3. The portability of JDBC is better than ODBC. In general, after you install the ODBC driver, you need to go through some configuration before you can use it. Different configurations cannot be common between different database servers. In other words, the installation needs to be configured once. However, the JDBC database driver is different. If you use the JDBC database driver, no additional configuration is required knowing that you need to select the appropriate JDBC database driver. During the installation process, the JDBC database driver completes the relevant configuration by itself. For this reason, JDBC is more portable than ODBC.

In short, JDBC and ODBC are database launchers, they are essentially the same, are designed to deal with SQL statements. And when JDBC is designed, it is also designed on the basis of ODBC, and retains some of the functions of the ODBC database driver. In other words, we can think of JDBC as another advanced version of ODBC. JDBC has made some improvements in operation and friendliness.

The difference between JDBC and ODBC: when will JDBC be adopted?

Although JDBC database startup program has many advantages over ODBC, it does not mean that JDBC database startup program can play a good effect in all cases. Database administrators also need to make choices according to the actual application environment of the enterprise. In general, the author recommends using the JDBC database driver if any of the following conditions are met.

One is to use Oracle's Oracle JDeveloper 10G to develop applications. JDeveloper 10G is a visual development environment provided by Oracle. It can help database administrators and developers to complete some complex functions conveniently. For example, database developers can use this tool to design the web page execution process of WEB applications; for example, it can be used to develop business service layer components; for example, data binding functions can be implemented in JSP and JClient applications, and so on. Especially when using this tool to develop business service layer components, you can directly browse and access the data corresponding to the business components. Database developers do not have to wait until the application is written to test the access functionality of the database. Obviously, this feature makes it very convenient for database developers to develop database applications. In order to cooperate with this development tool, Oracle has specially developed the corresponding JDBC driver. For this reason, if database developers use JDeveloper development tools, then using JDBC is better than using ODBC. So if you use this kind of development tool, you can start the program using JDBC database.

Second, if the application uses the JAVA development platform, then * use the JDBC database to start the program. In fact, JDeveloper also uses the JAVA development platform. This is mainly because it is easier to have security problems when JAVA programs directly call the C language API of ODBC. For example, the Java language does not use pointers (because the processing efficiency of pointers is slow), while the C language used by ODBC uses a large number of pointers. For this reason, if you use the Java language platform to develop database applications, if you use ODBC database driver, it is not so appropriate. In addition, because JDBC is also developed in the JAVA language, its compatibility will be much better. For this reason, the author suggests that if the database developer uses the JAVA language development platform, then * use the JDBC driver instead of the ODBC driver.

In other cases, database administrators and developers can choose the appropriate database driver according to their own habits.

The difference between JDBC and ODBC: can you make a smooth transition from ODBC to JDBC?

Maybe the database administrator used to use the ODBC driver, but if the database administrator needs to use the JDBC driver now, can you make a smooth transition? The answer is yes. There is a class of JDBC drivers called JDBC-ODBC bridging launchers. The underlying layer of this type of JDBC database driver is to connect to the database through the ODBC driver. If the original application is based on the ODBC database driver, or if the database does not provide a corresponding JDBC driver, the database administrator can use the JDBC-ODBC bridge driver to implement it. That is, bridge drivers can use existing ODBC drivers to access relational databases. To do this, they can not only retain the previous development architecture (to access data through ODBC), but also immediately use JAVA as a new development environment, thus realizing a smooth transition from ODBC database driver to JDBC.

However, there are several issues to pay attention to when using this bridging driver. One is that the bridge driver still needs to use the ODBC database driver. Because the object directly contacted by the bridge driver is the ODBC driver, and then access the database through the ODBC driver. To do this, you must first install and configure the ODBC driver on the client side. If you are using a three-tier development structure, you also need to install the ODBC driver. Second, in this mode, the application calls JDBC first, and then calls ODBC,*** through JDBC before communicating with the database. Obviously, there are a few more links in the middle. Because there are many intermediate links, but when there is a problem with data access, it is not easy to find out the problem. This is like a water pipe, if there are more connections in the middle, the probability of leakage is higher. If a leak does occur, it will be difficult to find the leak point. For this reason, the author believes that the bridge type of JDBC driver is only an expedient measure. In due course, database developers still need to adjust the original development architecture and switch to the JDBC driver. The bridge program only buys a certain amount of time for database developers. Although the labor pains in the process of transformation are painful, they are inevitable. Long pain is not as good as short pain. The author suggests that database developers should make the transition as soon as possible. And, where possible, adjust the previous development architecture to adopt a real JDBC driver.

These are all the contents of this article entitled "what's the difference between JDBC and ODBC". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report