If you are exposed to something new, you may feel at a loss. But if it is an old thing, is it still difficult for you to learn?
I. ODBC, our old friend
ODBC (Open Database Connectivity) is an interface specification between Microsoft and databases.
Highlights:
1. ODBC, which establishes a set of standards and provides a set of standard APIs for database access and standard application data interfaces.
2. ODBC is implemented in C language and a large number of pointers are used in it.
3. the use of ODBC drivers isolates applications from specific database calls. The driver manager centrally manages various drivers of a specific database, and provides unified standard interfaces to applications,
4. Structure Model: it consists of four parts: application interface, driver manager, database drive and data source. See the following figure for details:
2. JDBC should be heard
The emergence of JAVA language has swept the world. At that time, JAVA staff encountered a lot of trouble when using ODBC to operate database applications. For example, ODBC was implemented in C language and contains a large number of pointers, this idea of completely Object-Oriented JAVA is a huge conflict, leading to the unavailability of many excellent JAVA features, such as platform independence and object-oriented features.
As a result, SUN developed a set of Database Application Development interfaces with special java language.
JDBC (Java DataBase Connectivity) is an interface specification for Java and databases.
Highlights:
1. JDBC defines a general low-level application programming interface (API) that supports the standard SQL function ).
2. JDBC is implemented in java, fully object-oriented, platform-independent, consistent, secure, stable, distributed, and easy-to-use, and extends java capabilities.
3. JDBC uses a database driver to communicate with a database. With Java's platform independence, JDBC applications can naturally implement cross-platform features. Therefore, JDBC is more suitable for database applications in heterogeneous environments on the internet. (Same as ODBC)
4. Structure Model: it consists of four parts: application interface, driver manager, database drive and data source. (Same as ODBC) See the following figure:
Iii. Comparison
Similarities:
1. Both JDBC and ODBC are SQL call-level interfaces based on X/Open;
2. Many JDBC design ideas follow ODBC, including many abstraction and SQL cli implementation; ODBC and JDBC provide support for the SQL language;
3. The overall structure of JDBC is similar to that of ODBC,
Differences:
1. ODBC is written by Microsoft in C language and uses a large number of pointers. JDBC is written by SUN and fully object-oriented in JAVA.
2. ODBC is hard to learn. ODBC blends simple functions with complex functions, and even simple operations are complicated. JDBC is easy to learn and the design concept is simple, if necessary, users are allowed to use advanced functions.
3. ODBC drivers and drivers must be manually installed on each client. JDBC drivers can be automatically installed on all JAVA platforms because they are all written in JAVA.
Iv. Expansion and summary
Extension:
JDBC-ODBC, the reason for its appearance is very simple: we sometimes need to use JAVA to connect to Microsoft's database, but because Microsoft's database is not written by JAVA, so we need a bridge connection.
The specific implementation is not mentioned here, but one thing to note is that JDBC is directly connected to the database using the JAVA Database driver, and the JDBC-ODBC is connected to the ODBC data source, ODBC is the real connection to the database!
Summary
Technically, the summary is summed up in comparison. Here I just want to explain one thing. I plan to understand JDBC from the very beginning, and then I think of ODBC, however, ODBC is only used, so it feels messy. After a few days of sorting out, I found that what best helps me find out the relationship is "tracing the source ", from the "root" Check, this is a kind of Knowledge Network regeneration long, expansion out or more intensive feeling, rather than abrupt appearance of a point, let your own brains to find a strong relationship, but naturally, it is easy to develop. I feel that this learning method is better and more efficient. I recommend it to you!