JDBC learning notes (1)

xiaoxiao2021-03-06  98

JDBC learning notes (1)

Author: thinkersky [Email: yanghuangming@rongji.com]

Learning Java for nearly two months, the early exposure is just about the knowledge of layers and logic layers, and since it is considered to have a preliminary understanding of the MVC three-layer control mode and Struts, it has been prepared in the near stage. Relevant knowledge is on the ground. Start from JDBC. The following is a little experience, many Dongdong is from the network (so the network is definitely good).

1, the definition of JDBC

What is JDBC, I believe that xdjm with a database programming experience must be familiar, JDBC definition is two groups of API (Application Programming Interface), respectively, the application developers and database driver developers, and the former The inner package logic transformed by the latter. For Java developers, we only care about the interface of the application developer, the JDBC API, which is the free version of Sun's free version of JDK in the package java.sql. *, A series of classes, interfaces, interfaces (Interface), exception, and attributes (Property) and methods defined in these classes and interfaces. Regarding the definition of JDBC, there is so much nonsense, I am a little dizzy, what about you?

2. Model for developing database application systems

Model This East, from I started learning OOP, like a fidum, it can be seen everywhere, but I can't open it. According to the heavens and the world, we will take the essence, to go to their dysfunction, and the typical development model of JDBC can be divided into two, respectively, two and three-layer structure.

1 Layer 2 mode

Under this structural model, the application (client) is directly connected to the database server, as shown in the figure:

Figure 1.1 Database two-layer structure model diagram

This structure is a database model of a local area network-based software system within a general small and medium enterprise, which has the following characteristics:

(1) The client program sends the SQL request directly to the database server, the server returns the corresponding result ,??????? The client is standardized, the structure is simple, and the execution is fast.

(2) A large number of client origin needs to be rewritten when changing the database manufacturer.

(3) is restricted by the database version, when updating the database, using the original database application to recompile and release.

(4) All operations with access to the database management system are implemented in the client application, causing the client's design and modification complex, increasing the cost of the client.

I don't know how many people are using this model. Anyway, I don't need it, the company is not allowed (our department is developing B / S mode), huh, huh.

2 three-layer structure

In the three-layer structural model, a intermediate server, client and intermediate server communicate between clients and database servers, process access controls for the intermediate server, and control access control to one or more database management systems. as the picture shows:

Figure 1.2 Database three-layer structure model diagram

This structure is the most common mode of Internet, which has the following features:

(1) Application client is not directly connected to the database server, and its respective design is independent, and the replacement of the database management system does not affect the client's program. For example: a web server for a WWW website uses Apache Tomcat to responate a JSP program. The website's database server uses MS SQL Server. Internet users use Internet Explorer or Netscape CommunicTor (client) to browse the site. Suppose the site replaces the database server to Oracle, simply make a simple change in JSP source code. The client (IE or NC) does not need to make any changes, and it is still possible to normally browse the site. (2) Treatment and data operation of intensive tasks abstraction to higher levels, simplifying the design of the client, preventing too bloated in the customer's changing.

(3) The client's request is handled by a dedicated high-performance server, communicating with the database, and improves the access efficiency of the database.

I don't know how much you understand, anyway, all the projects developed during the university use this model, ASP.NET SQL Server 2000, unusual. In fact, the three-layer structure will become more common, because for MIS managers, this can make them an opportunity to explicitly define legal operations on public databases.

OK, learn this point first, there is also the Olympic game in the evening, but the standard patriot, although the advantage project of the Chinese team will come to the curtain, but insist on the programs of our programmers.

2004-8-25

转载请注明原文地址:https://www.9cbs.com/read-123592.html

New Post(0)