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 (CONNECTIVITY,ODBC) is an integral part of the database in the Microsoft Open Service Architecture (Wosa,windows Open Services Architecture), which establishes a set of specifications and provides a set of standard APIs (application programming interfaces) for database access. These APIs use SQL to accomplish most of their 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 different vendors ' DBMS and specific programming languages (but Microsoft's ODBC documentation is described in C, and many of the actual ODBC drivers are written in C language. The ODBC specification was later adopted by X/open and ISO/IEC, as part of the SQL standard, which can be seen in the relevant standard documents such as ISO/IEC 9075-3:1995 (E) call-level Interface (SQL/CLI).
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
Perhaps the database programming used to be the ODBC driver, and if the database programming now need to use the JDBC driver, 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, in the time of using this bridge driver, the need to pay attention to a few difficulties. 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. Reference article Http://blog.sina.com.cn/s/blog_ 4cf8aad30100lx47.html (seemingly blogger is translated, a lot of words used not too suitable, understand some difficulties, I combined with their own knowledge to do the replacement) a little bit of personal understanding and collation, there are shortcomings please criticize correct.
JDBC and ODBC