Access Technology of Java database

Source: Internet
Author: User
Tags rounds

It technology is changing rapidly, and new technologies appear to be dizzying, and every day seems to be producing a term. Ultimately, however, it is the value of the data that is collected and then presented to the customer in the form that the customer wants. Therefore, data access technology has become an eternal topic. In the open world of Java, Database access technology is diverse and varied. We also come to regaling the mainstream database access technology in the Java world.

First Lists the Heroes list

1. JDBC Direct access to the database

2. EJB entity Bean.

3. JDO technology.

4. Third-party O/R tools, such as the current rounds hibernate, others such as Castor, Toplink.

Let's talk about the oldest JDBC in the history. From the day of the birth of Java, this man began to climb the stage of history. Java can be so beautiful today, JDBC can be said to be a success. Along the way, it is now JDBC3.0. In the absence of JDBC, access to the database that is eight Immortals crossing, recount, each of the database vendors have their own set of APIs, suffering the development of people. Change a database, that program to change is beyond recognition. The introduction of the JDBC specification announces to the world that there is a standard universal interface for accessing relational databases. The JDBC standard is supported by almost all database vendors, and it seems like it's hard to find a database that does not have JDBC support. Once the JDBC specification was published, it gained unprecedented success and soon became the standard for Java access to the database. The success of JDBC lies in its standardized interface, which requires only a standard SQL language to access a variety of different databases. This kind of database portability and Java has been shouting slogans compile Once, Run everywhere echo. JDBC is still the cornerstone of Java's access to the database today, CMP, JDO, Hibernate is just a better encapsulation of JDBC, providing a more powerful interface on the upper level. Then talk about how JDBC accesses the database directly to implement Java persistence.

This approach is straightforward compared to CMP, especially for small applications. For example, I want to write a simple message version of the program, there is no need to session bean, entity Bean, but also the home interface is the remote interface, a layer of adjustment bar. Direct JDBC, write SQL statements. Compared to other persistent technologies, the way JDBC directly accesses the database requires the programmer to worry about things a little more, you have to care about transaction, you care about the connection pool, you have to write a lot of Get set method, the SQL select out of the value of one plug into your Java object, or remove the value of Java object One by one, use SQL insert to the database, and completely manually perform the O/R mapping. In order to overcome these shortcomings, CMP, JDO and so on began to climb the historical stage.

The easy-to-use

Do is the most praised, does not require you to write a lot of useless interfaces, do not need you to inherit any special class, the only thing to do is to enhance your class file. With JDO, can say our Java program This really oo, we do not have to ignore the database in what form, access to Java object as the object, all database tables are automatically generated. This can be said to be a revolution. Prior to the project design phase, the Database schema design could be a highlight. Now with the development of JDO, there is no need for database design at all. What about your Database schema?   is your class , JDO will automatically generate the corresponding database table based on your class.   A word  ,  cool! From the database portability point of view, JDO is also an obvious advantage, I used the kodo  and  genie, a few simple applications in exchange for a database in addition to a jdbc driver,  change the database URL, There is no need to make any changes to the program.   This is a disadvantage for ejb . From the family background, Jdo is also born in the family, from the beginning of the JCP under management. From an enterprise-level support perspective, it works well with Session bean, and for enterprise-level development, the  SESSION BEAN + JDO approach is Session bean A strong competitor of the  + entity way. Although there are so many advantages, but its development path is not smooth sailing, this is not, this May JDO2.0 vote,ibm, oracle, bea  Three big giants at the same time voted against. But a little bit, it can be understood that this is not JDO's own technology has any major flaws, but JDO moved to these giants cheese. BEA, IBM is doing the industry's most famous application server, WebLogic and WebSphere, in the EJB above is dropped the lost money, they can not watch jdo to eat the EJB market. And oracle,  is still selling its own O/R tool toplink,  look at JDO increasingly powerful, he can not worry about it. However, the company again cattle, he also block the history of the wheel bar, the final JDO2.0 vote or absolute votes (12:3) passed.

There are other scattered rivers and lakes of Java persistence technology, such as Hibernate, Castor, Toplink, although they do not have royal blood, but the strength is not to be underestimated. For hibernate, it is Javaworld's best Java data Access tool of the year 2003, which is now rounds. And Castor and TopLink is also a long history, in Jdo not born before, they are mixed in the lake. At present, also occupy a certain market. These third-party tools are functionally similar to JDO, except that their respective APIs differ. It is also a reason why the jdo of the norm has become more and more high later. These third-party O/R mapping tools can stand out in the lakes and rivers, and indeed have their own extraordinary places. such as the Hibernate brand is open Source, supporting almost the world can see most of the database, and the documentation is very complete. TopLink, it is a long history, but also the list of Oracle this big tree. For now, these tools also occupy a small market for Java database access. Personally, with the JDO specifications of the perfect, jdo product popularization, this part of the staff may gradually withdraw from the historical stage in the future. However, from the current heyday of hibernate, it seems premature to say this sentence.

The pros and cons of these technologies have never stopped from the day they were born, and the factions have never been able to persuade each other. For our application developers, it doesn't make much sense to put aside the application purely to argue the pros and cons of technology. Or as the saying goes, there is no best, only the most suitable. We are able to choose a technology that is best suited to your application when doing development, which is enough. In general, JDBC is geared towards RDBMS and is more suitable for relational database schema-driven applications such as statistical tabular data, and for generating reports. EJB technology is centered on the Java EE Application Server, and if your application does require flexible and declarative transaction boundaries, requires support for large-capacity access and uninterrupted service, and requires cluster of application servers, then choose EJB. Jdo object-oriented, for the domain object-centric application, including graph, tree model of the application, JDO is preferred.

Access Technology of Java database

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.