The stub/skeleton layer is the interface between the Java program and other parts of the RMI system. In the RMI system, this layer actually plays the role of proxy. stub and skeleton are the agents of the customer program and service program respectively. On the client side, the client program sends a remote method call request to stub, and stub is responsible for passing these requests to the server and returning the call results to the client program. On the server side, the call request from the client is received by skeleton, and skeleton is responsible for calling the corresponding object method for the service. The call result is also returned to the client by skeleton. The remote reference layer refers to the semantic Implementation of Remote Object Reference. All operations on remote objects, including copying objects, are managed by the remote reference layer. The transport layer is responsible for listening to incoming call requests, establishing connections for them, and managing and monitoring these connections, at the same time, a remote object table is maintained for all remote objects in the address space to locate the target of Remote Call. 2.3 Object serialization Technology Object serialization is also used in the RMI system ). Object serialization is essentially the code for Java objects. During a remote method call, it is responsible for first encoding the Java objects to be transmitted by the sender into word throttling before network transmission, on the receiver side, it is responsible for restoring the received byte stream to a Java object, thus achieving transparent transmission of objects in different address spaces. 2.4 RMI Objectives RMI is designed for the Java language. Its goal is to implement seamless remote calls to objects on different virtual machines, and naturally integrate the distributed object model into the Java language, it is possible to retain Java's object-oriented features in terms of semantics, as well as the security provided by the Java Runtime Environment. In the RMI system, the Implementation Details of all remote method calls are transparent to Java programs. The reference between remote objects is as simple and natural as referencing local Java objects, conforms to the object-oriented semantics. In RMI, calling remote methods is very important. syntactically, it is consistent with calling local methods.3 Implementation of Distributed Database interoperability in a Java-based Web Environment 3.1 Implementation of JDBC's Interoperability with heterogeneous databases To access various heterogeneous databases in JDBC, there is a simple and quick way to Use ODBC, which is a mature database application technology, it provides unified access interfaces for various heterogeneous databases. Therefore, we only need to use the JDBC-ODBC bridge driver to achieve transparent access to a variety of relational databases, so that JDBC applications and their drivers are independent of the database. 3.2 use RMI to solve Java's limitations on applet Security For JDBC applications, the biggest advantage of RMI is that it can surpass the network security restrictions imposed by Java applet. As the client of the RMI system, the applet is downloaded from the host node where the RMI server is located and can access resources on the RMI server, it can send database access requests to the server and receive data returned by the server. As a Java application RMI server program, it does not have the same restrictions as applet. It can access resources on other hosts, including databases. It is responsible for receiving database access requests from the client applet, accessing database resources through JDBC based on requests, and returning the access result data to the client applet. In fact, the RMI server program becomes a proxy for the client applet to access the database, blocking Java's security restrictions on the applet. 3.3 Use RMI and JDBC to implement a three-layer Client/Server structure model An Improvement Method for the traditional layer-2 structure is to adopt the client/server layer-3 structure, and add an "intermediate layer" between the client and the database server ", all database access on the client is performed by the middle layer. The access result data is received by the middle layer from the database server and forwarded to the client. The middle layer actually acts as a proxy. The RMI server serves as the intermediate layer between the customer and the database server and is responsible for data communication between them. The database access request of the customer's apple T is submitted to the database through the RMI server, and the access result is also transmitted by the database server to the customer applet through the RMI server. The RMI server is actually a JDBC application. It communicates with the client applet through the RMI system and serves it. It establishes a connection with the database server through JDBC, the connection between the client Applet and the database server is realized. The combination of RMI and JDBC enables remote data access in the Web environment. One obvious advantage is that, as a client's Java program, it no longer needs to call the lower-layer jdbc api, instead, the server provides corresponding high-level APIs. As an RMI server, you can add certain constraints to the client's applet requests, increasing the flexibility and security of the system. 3.4 implement one n-layer Client/Server structure The layer-3 model described above is the basis for developing distributed database applications in the Web environment. Based on the features that RMI supports point-to-point communication (that is, RMI programs on one node can be both server programs and client programs, you can implement an application in layer-N Client/Server mode as shown in step 2. Figure 2 Application of layer-N Client/Server mode in distributed databases
This application system is composed of many servers distributed on different host nodes and their direct clients. Each server and its direct client constitute a three-tier structure system. The server is composed of HTTP server, RMI system (server/Cl ient), JDBC, ODBC, and SQL database server, each Server communicates with other server and direct clients connected to it through the RMI system. In the entire system, it serves as a server, providing data services for direct customers and other servers, and as a client, and can apply for data services from other servers. In actual applications, each server has a table that records the addresses of other servers connected to it. Each server's direct client can send a database access request to its server, the server first queries the database on its own node. If the corresponding information exists, the server returns it to the client. Otherwise, the server sends a query request to other servers according to the address table; if the other servers have the relevant information, they are also returned to the client. Otherwise, the client fails to query. Obviously, all clients can transparently access the databases on all servers. In this way, you can implement a distributed database application in a Web environment. 4. Summary Using JDBC and RMI to implement distributed database interoperability in the web environment is an attempt to apply Java technology and an improvement to the traditional C/S architecture, it has the advantages of simplicity and efficiency. Combined with the various good features of Java, especially the emerging RMI technology and the JDBC technology supported by the industry, I believe it will develop towards standardization, and will be more widely used. Author unit:Key Laboratory of parallel and distributed processing, Changsha National University of Defense Technology (410073) References 1 Rasmussen B .WDB-A Web interface to SQL databases. European Southern Observatory, http://arch-http.hq.eso.org/bfrasmus/wdb/wdb.html,1997 2 naguyen T, srin1_v. accessing relational database from the World Wide Web. ACM sigmod '96 Montreal, Canada, 1996 3 yaylor A. JDBC developer's resource. Prentice Hall PTR, http://www.preh all.com, 1997 |