J2EE-based Distributed Database

Source: Internet
Author: User

Enterprises with geographically dispersed subsidiaries are geographically dispersed, resulting in scattered business data. The company and its subsidiaries are located in different cities or regions in different cities, in terms of business, apart from processing their own data, they also need to exchange and process data between them. The author discusses the framework model for building a distributed database system using J2EE technology.

Distributed Multi-layer architecture

J2EE (Java2 platform Enterprise Edition) is a platform proposed by Sun for developing and deploying L3 Enterprise-level applications. It is a complete set of technologies and specifications, including the establishment of various aspects of Enterprise application systems. Using j2EE technology, you can quickly establish a scalable enterprise application system. Its goal is to provide a Java-based server application structure that supports enterprise-level applications with independent platforms, portability, multiple users, security, and standards.

The foundation of J2EE technology is the standard version of the core Java or Java 2 platform. J2EE not only consolidates many advantages in the standard version, such as the feature of "writing a program to run everywhere, convenient access to the jdbc api and CORBA of the database, as well as the security mode that can protect data in Internet applications. It also provides) java ServletsAPI, SP (Java ServerPages), and XML technology support. The J2EE architecture 1 is shown in.

: J2EE architecture

This architecture can be roughly defined as the presentation layer on the client, the business logic layer in the middle, and the data logic layer in the background. The client can first send a request to the assumervlet or JSP running on the Web Server, and embed Java code in the JSP to call the EJB running on the EJB Server to implement business logic.

The EJB component is the core of J2EE. It is based on Java RMI, HOP, and JNDI technologies and can be divided into session Bean, Entity Bean, and message-driven Bean.

Session Bean proxy client requests to the server, simulates the business process, and obtains data by calling the Entity Bean to process the business logic. The Entity Bean is used to simulate business data. It is a kind of object-oriented in-memory view in the data storage layer and a mechanism that combines data persistence functions with object encapsulation, it corresponds to the data storage layer l2 J in the multilayer application architecture.

The existing database system can be mapped to the EJB structure through BMP (Bean Managed Persistence) or CMP (ContainerManaged Persistent. The message-driven Bean contains the message-oriented logic and the call Session Bean logic. Using ejbs, you can gain the transparency of distributed transaction management, security check, resource management and lifecycle, persistence, remote access capability and location. The interaction between EJB and client is shown in figure 2.

: Interaction Between EJB and customers

A distributed database system is a set of datasets logically belonging to the same system but physically dispersed in multiple locations (nodes) connected by computer networks. The system emphasizes the autonomy of nodes rather than the centralized control of the system, and the system should maintain the distribution transparency of data so that the distribution of data can be completely ignored during application programming.

EJB is based on RMI/IIOP and has a natural distribution. The EJB container can provide transaction support for data operations. Therefore, you can use EJB to implement a distributed database system.

The following analyzes the defects of the two common design architectures, proposes the architecture design of a distributed database system implemented using J2EE, and finally provides a design model.

Two architecture design methods and their disadvantages

Architecture Design Scheme 1

: Architecture 1

3. In addition to calling the local database, each Web server also calls a remote database. The returned data is summarized and returned to the client. In this case, the logic code is distributed across multiple Web servers on multiple sites. The Calling relationships of each Web server are different. When a database is added, the Code on the Web servers of all sites must be changed. The new Database Calling support is added, which makes code maintenance difficult, poor scalability, and unclear Database Calling logic, in fact, a net call relationship is formed.

For example, if DB4 is added, the code from DB1 to DB3 needs to be changed, and the Code for accessing DB4 is added to provide access support for db4.

Architecture Design Scheme 2

Cancel the Local Web server on the basis of architecture 1 and centralize all business logic on one Web server, which will eliminate the Net call relationship, when a new database is added, you only need to change the intermediate logic to improve the scalability of the system. Architecture 24.

: Architecture 2

Different clients send access requests to the same Web server. The Web server automatically identifies the client source and accesses the data sources distributed in different locations as required. The summary result is returned to the user.

To add a data source, you only need to modify the business logic on the Web server. However, in this case, the Web treats the local database of each branch as the remote database, because the client and the Web server that stores the business logic are not necessarily local.

When the customer only needs to discard local data, they still need to access the remote Web server, and the Web server will access the customer's local data and then return it to the local customer.

Link

The collection, storage, processing, and dissemination of data by database technology are from centralized to distributed and from closed to open. The distributed database system enables proper data redundancy through replication, which increases the reliability and availability of the system. It provides local autonomous data sharing and venue coordination, this gives the system fast data processing capabilities.

Link

Call relationship:

◆ The customer sends a request;
◆ The Web server queries the local database;
◆ Results returned by the local database;
◆ The Web server formats the result and returns it to the client.

Related Articles]

  • Panoramic Analysis of Distributed Databases
  • Measure the test taker's understanding about the advantages and disadvantages of the distributed database system.
  • Distributed Database Overview
  • Use C # for Distributed Database Query

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.