Introduction
Now the various database applications, because of technology, history and other factors, often in a large department coexist with multiple application systems. These application systems may be dispersed in different network nodes, based on different operating platforms, using different database management system, and each subsystem closed operation, self-contained, which brings difficulties to the sharing of information resources in different departments. How to complete the data access and exchange between different database systems without changing the internal information of the original system is a problem worth studying.
Java Solution for Multi-database system
Multi-database system is composed of a variety of ways, in these ways, we examine the different points of these multiple databases, which are mainly manifested in the following aspects of the heterogeneous:
(1) The heterogeneity of database logical data model: There are five kinds of databases, such as hierarchy, network, Relation, object-relation and object.
(2) Heterogeneity of database physical data model: Physical data model reflects database storage structure, such as physical block, pointer, index, etc., even if the logical data model is the same, such as Oracle, SYBASE, DB2 of relational database, and so on, its physical data model is also different.
(3) Operating system heterogeneity: UNIX, Windows series, MacOS, OS/2, DOS and so on.
(4) Heterogeneous computer platforms: From Giant, large, medium and small machines to workstations, microcomputers and handheld machines.
(5) Network heterogeneity: LAN, WAN, Ethernet bus structure and Token ring structure.
In these heterogeneity, some are caused by the history of the database, such as hierarchical, network type of database, some are different database developers developed different database management system, some of the different computer operating systems, and some of the network structure and computer platform reasons. For these differences, from the current point of view, we think that the current should focus on the relationship between the different operating systems and different database management system.
As we all know, Java technology is a new programming technology, it has platform-independent, object-oriented, security, high-performance, distributed, multithreading and other characteristics, so that Java become the most current type of programming language and platform. For multiple database system federated access and data exchange, Java technology can be used to solve the data processing between different operating systems and different database management systems.
1 using Java Bean Technology to achieve multiple database access
Java Bean is a Java model component that provides a standard format for using Java classes, which automatically obtains information about this standard-formatted class in User programs and visual management tools, and is able to create and manage these classes.
Multi-database access based on Web is a form of multiple database combined application in the rapid development of e-commerce and e-government. Under the condition of heterogeneous database and operating system, only Java technology can solve this kind of multiple database application problem with large amount of data.
For multiple database access under the Web, the new technology for Java is the servlet. The Java servlet is a Java program that runs on the server side. Now with the introduction of the servlet API2.3 version, the server's servlet will bring Java Web software development to a higher level. The servlet provides a fast, powerful, and flexible development environment. The developed servlet can run in the process space of the server and can handle multiple requests at the same time. Of course, the most commendable is the platform-independent nature of the servlet.
For web-based multiple database access, Java Bean technology can provide a powerful, flexible solution. First, we construct multiple Java beans, in which we handle the connection, definition, lookup, insert, and delete operations of the database, implement multithreading, and then construct the servlet that invokes the Java bean, which enables access to multiple databases. The Java bean is structured as follows:
public class DatabaseConnectBean
{
定义数据库连接的成员;
定义连接的方法{ }
……
}
The process of invoking Java beans in the servlet is:
public class UsedatabaseBean extends HttpServlet
{
public void doGet(httpServletRequest req,HttpServletResponse resp) throws ServletException,IOException
{
……
}
public void doPost(httpServletRequest req,HttpServletResponse resp) throws ServletException,IOException
{
……
//创建Java Bean的对象
DatabaseConnectBean conBean=new DatabaseConnectBean(……);
//使用conBean进行数据库的操作
……
}
}
From the above procedures and statements we can find that the use of servlet technology to access a variety of different types of databases, but the use of servlet technology Java Bean Technology to ensure the consistency of database data, should be in the Java In the bean we can connect and manipulate the database using the methods of synchronization in Java thread technology, but this will increase programmer's programming implementation. So Java beans using servlet technology can access multiple database entities at the same time, but it is inconvenient to implement.