The present invention relates to a connection control device and a connection control method for controlling connections to a database or the like.
Databases are utilized in various fields of information processing in order to store data and share data among many users.
Structured Query Language (SQL), which has been developed by IBM Corporation, is commonly used to operate databases at present.
DBMS (Data Base Management System) is known as a system for storing and retrieving data by analyzing a program that is written in SQL.
Products to which SQL and DBMS are applied are disclosed in various documents including http://www.microsoft.com/sql/.
For example, COM+, which has been developed by Microsoft Corporation to support database operation, is disclosed in http://www.microsoft.com/japan/com/compres.asp.
Currently, a common way to operate a database is to performing database operation processing separately for a UI layer, which provides a user interface; an application layer, which provides functions for the business or other functions; and a data layer, which provides a function of accessing the database.
A database, which is implemented by allocating functions among three layers, as described above, is sometimes called a three-layer system.
In the three-layer database, programming of the application layer tends to be complicated and take many steps.
When applied to the three-layer database, COM+ mentioned above enhances the independence of the respective layers and facilitates programming of the layers.
On the other hand, the use of COM+ which enhances the independence of each layer tends to make debugging of a created program throughout all the layers difficult, and make maintenance after shipment of the product accordingly difficult.
[Non-Patent Document 1] http://www.microsoft.com/sql/
[Non-Patent Document 2] http://www.microsoft.com/japan/com/compres.asp
The present invention has been made in view of the background described above, and it is an object of the present invention to provide a database operating device and a database operating method with which programming for operating a database is facilitated.
Another object of the present invention is to provide a database operating device and a database operating method with which debugging and maintenance of a program for operating a database are facilitated.
To attain the above-mentioned objects, according to the present invention, a database operating device for operating a database through processing divided into multiple layers, the processing being one or both of activating processing, which activates processing of another layer, and activated processing, which is activated by the activating processing, one or more of the activated processing being database operation processing for operating the database, includes: a group defining means which defines a processing group including one or more of the activating processing; and a processing control means which, in accordance with progress of activating processing included in the processing group and a processing result of database operation processing that is activated by the activating processing included in the processing group, controls at least what operation is performed on the database through the database operation processing.
Preferably, the layers are three or more separate layers, and the processing control means further controls, in accordance with the progress of the activating processing included in the processing group and the processing result of the activated processing that is activated by the activating processing included in the processing group but is not database operation processing, processing specifics (contents) of the activated processing that is not database operation processing.
Preferably, the database operating device further includes a library means which includes one or more of the database operation processing, in which activating processing that activates the database operation processing activates the database operation processing included in the library means.
Preferably, the database operating device further includes: a storage area setting means which sets, for each of the processing groups, a storage area for the activating processing that is included in the processing group and the activated processing that is activated by the activating processing included in the processing group; and a data management means which manages data used for processing included in each of the processing groups in the storage areas that are set to the respective processing groups.
Preferably, each one of the activated processing sends a returned value which shows the processing result to the activating processing that activates this activated processing, in which the layers include an interface layer, an application layer, and a database layer; the interface layer includes one or more of user interface processing which activates, as the activating processing, in response to external operation, the activated processing that is included in the application layer, and performs processing in accordance with the returned value sent from the activated processing that is activated by the user interface processing; the application layer includes one or more of application processing which, as the activating processing and the activated processing, is activated by the interface processing, activates one or more of the database operation processing included in the database layer, carries out a service that uses the database in accordance with the returned value sent from the activated database operation processing, and sends a result of the service as the returned value to the user interface processing; and the database layer includes one or more of the database operation processing which, as the database operation processing, is activated by the application processing, operates the database, and sends a result of the operation of the database as the returned value to the application processing.
Preferably, the processing control means controls execution of the database operation processing as follows: when the application processing included in the processing group activates the database operation processing for the first time, the activated database operation processing is connected to the database; and when the database operation processing that is activated last by the application processing included in the processing group, or when the database operation processing fails, the activated database operation processing is disconnected from the database.
Preferably, the processing control means commits to the database a result of the database operation processing activated by the application processing included in the processing group in a case where the database operation processing that is activated last by the application processing included in the processing group is successful, and, in any other cases, the processing control means restores the database to a state before the database operation processing is first activated by the application processing included in the processing group.
Preferably, when the database operation processing activated by the application processing included in the processing group fails, the processing control means restores the database to a state before the database operation processing is first activated by the application processing included in the processing group.
Further, according to the present invention, an information processing device for performing given information processing through processing divided into multiple layers, the processing being one or both of activating processing, which activates processing of another layer, and activated processing, which is activated by the activating processing, includes: a group defining means which defines a processing group including one or more of the activating processing; and a processing specifics control means which, in accordance with progress of the activating processing included in the processing group and a processing result of the activated processing that is activated by the activating processing included in the processing group, controls the specifics of the activated processing.
Further, according to the present invention, a database operating method of operating a database through processing divided into multiple layers, the processing being one or both of activating processing, which activates processing of another layer, and activated processing, which is activated by the activating processing, one or more of the activated processing being database operation processing for operating the database, includes: a defining step which defines a processing group including one or more of the activating processing; and a processing control step which, in accordance with progress of activating processing included in the processing group and a processing result of database operation processing that is activated by the activating processing included in the processing group, controls at least what operation is performed on the database through the database operation processing.
Further, according to the present invention, an information processing method for performing given information processing through processing divided into multiple layers, the processing being one or both of activating processing, which activates processing of another layer, and activated processing, which is activated by the activating processing, includes: a group defining step of defining a processing group which includes one or more of the activating processing; and a processing specifics control step of controlling, in accordance with progress of the activating processing included in the processing group and a processing result of the activated processing that is activated by the activating processing included in the processing group, specifics of the activated processing.
Further, a first program of the present invention relates to a program for a database operating device for operating a database through processing divided into multiple layers, the processing being one or both of activating processing, which activates processing of another layer, and activated processing, which is activated by the activating processing, one or more of the activated processing being database operation processing for operating the database, in which the program causes a computer to execute: a group defining step which defines a processing group including one or more of the activating processing; and a processing control step which, in accordance with progress of activating processing included in the processing group and a processing result of database operation processing that is activated by the activating processing included in the processing group, controls at least what operation is performed on the database through the database operation processing.
Further, a second program of the present invention relates to a program of an information processing device for performing given information processing through processing divided into multiple layers, the processing being one or both of activating processing, which activates processing of another layer, and activated processing, which is activated by the activating processing, in which the program causes a computer to execute: a group defining step of defining a processing group which includes one or more of the activating processing; and a processing specifics control step of controlling, in accordance with progress of the activating processing included in the processing group and a processing result of the activated processing that is activated by the activating processing included in the processing group, specifics of the activated processing.
According to the present invention, the database operating device and the database operating method with which programming for operating the database is facilitated are provided.
The present invention also provides the database operating device and the database operating method with which debugging and maintenance of the program for operating the database are facilitated.
[Background Leading to the Invention]
A further description is given on the background leading to the present invention in order to facilitate understanding of the present invention.
It is a general notion that database operation requires a user interface function through which a user operates a database and a processing result is displayed to the user, an application function for operating the database in accordance with the user's operation to provide various services to the user, and a database function for actually accessing the database (DBMS).
Those three functions could be attained without dividing a program into layers as shown in the form of a list in
The program shown in
Each time a user enters a database operation command, first, a connection to the database (DB) is established and a transaction is started.
Next, as the transaction is started, necessary database operations are sequentially carried out.
After the database operation is finished, lastly, changes made to the database during the transaction and the like are committed, and the connection to the database is terminated.
However, writing a program without layering the program necessitates creating a program as the one shown in
Writing a program without layering the program therefore gives the program a large volume and provides an inflexible system configuration. In addition, since the program makes it difficult to divide a program module (mathematical function) into components, changing or adding a function is not easy.
For these reasons, a program for operating a database has now come to be created in a format that divides the program into a user interface layer (UI layer), which provides a user interface, an application layer (AP layer), which provides various services as applications of the database, and a database layer (DB layer), which actually operates the database.
As shown in
In processing of the application layer, first, a connection to the database is made, the database is opened, and a transaction is started (S104 in
Next, database operations (DB operations #1 and #2) are sequentially executed to provide a service. Each time database operation is executed, a database layer program is activated (S106 and S108 in
In the case where every database operation succeeds, the processing of the application layer commits results of the database operations, closes the connection to the database, and sends the processing results and a returned value to the processing of the user interface layer (S110 and S112 in
In any other cases, the processing of the application layer cancels the database operations and rolls back the transaction (S114 in
Lastly, the processing of the application layer closes the connection to the database, and sends the processing results and a returned value to the processing of the user interface layer (S116 in
The results of the processing of the application layer are presented to the user through the processing of the interface layer.
As shown in
However, the example shown in
The created two objects are handed as arguments each time a program module that performs the processing of the database layer is called up.
In the database layer, the two objects have to be handed as arguments not only to a program module for processing of actually operating the database but also to a program module for other processing than operating the database. This is likely to complicate programming of the application layer (however, the program module for other processing than operating the database here is not included in the list shown in
A program module that performs the processing of the database layer could be created in a manner that would eliminate the need to hand over an argument. In this case, however, a function of a program module cannot be changed with the use of an argument, and many program modules that have slightly different functions have to be created in the database layer.
It therefore increases in number of programming steps in the database layer and consumes considerable labor in debugging and maintenance of the created programs.
The operating system Windows (registered trademark) of Microsoft Corporation has a function called COM+ in order to make a program module of the database layer into components.
A program similar to the one shown in
As shown in
In the processing of the application layer, first, an attribute specifying the operation of a transaction is designated, database operations (DB operations #1 and #2) are executed sequentially to provide a service, and the database layer program is activated each time database operation is executed.
Results of the activated processing of the database layer are sent as a returned value to the application layer. Processing results and returned value of the application layer are sent to the processing of the user interface layer.
The results of the processing of the application layer are presented to the user through the processing of the user interface layer.
The use of COM+ thus heightens the independence of program modules in the database layer from the application layer.
In addition, programming is simplified since the application layer does not need to hand over an argument to each program module of the database layer.
However, to program successfully with the use of COM+, a programmer has to learn a specification unique to COM+ until he/she is skilled in its use, which takes a lot of labor and time.
Whereas the processing of the user interface layer shown in
Even when a process carrying out the processing of the user interface (UI) layer in
Accordingly, in order to accomplish program operation check and debugging throughout the user interface layer, the application layer, and the database layer, it has to be done as follows, for example. A break point is set to processing of activating the application layer program in the process of the user interface layer and, after its execution is stopped, a debugger is separately attached to the process of the activated application layer and carries out debugging.
This can take even more labor and time in program debugging and maintenance than the case where COM+ is not employed.
The present invention has been made in view of the background described above, and an embodiment of the present invention solves all the drawbacks of the methods heretofore given as the background.
The following embodiment of the present invention is given as an example, and is not intended to limit the technical scope of the present invention.
Function allocation among components of the following embodiment of the present invention is not fixed; a function of one component may be divided among multiple components and functions of multiple components may be gathered to one component.
An embodiment of the present invention will be described below.
As shown in
The server system 2 has a configuration in which a server 3 and a development/operation PC 4 are connected to each other via a LAN 20.
In the network system 1, the server system 2 has, for example, a function as a Web server utilizing a database, and provides various services to the client PCs 102-1 to 102-n.
Hereinafter, the client PCs 102-1 to 102-n may be referred to simply as client PCs 102, and the same applies when there are multiple identical components.
Each component of the network system 1 may be referred to as node.
As shown in
In short, the server 3, the development/operation PC 4 and the client PCs 102 have components of a general computer that can communicate with another node through the network 100 or the LAN 20.
As shown in
The server program 30 is supplied to the server 3 through, for example, the recording medium 130, and loaded to the memory 124 (
The server program 30 uses those components to provide various services to the client PCs 102 (
The DBMS 302 in the server program 30 operates the database module 300 under the control of the development/operation PC 4 to store data entered by the service providing module 304 in the database module 300.
The DBMS 302 also operates the database module 300 to read data stored in the database module 300 and outputs the read data to the service providing module 304.
The database module 300 stores data entered from the DBMS 302 and outputs stored data to the DBMS 302 in accordance with operation by the DBMS 302.
The database module 300 and the DBMS 302 perform the above-mentioned processing of the database layer, thereby providing database functions to the service providing module 304.
The service providing module 304 carries out services to the client PCs 102 and other components under the control of the development/operation PC 4, for example services as a database server or a Web server.
The service providing module 304 performs the above-mentioned processing of the user interface layer and of the application layer. In accordance with operation performed by users on operation images (not shown) which are displayed on the client PCs 102, the service providing module 304 utilizes the database functions provided by the database module 300 and the DBMS 302 to provide data stored in the database module 300 to the client PCs 102, or to store data entered by the client PCs 102 in the database module 300.
The service providing module 304 also makes the database module 300 store data entered by the development/operation PC 4 and output stored data to the development/operation PC 4 for debugging or other tasks in the development/operation PC 4.
As shown in
The program developing module 42 includes a program development assisting module 420, a debugger 422, and others.
The program execution control module 46 includes an execution control module 48, a UI layer control module 460, an AP layer control module 462, a DB layer control module 464, and others. The execution control module 48 is composed of a UI/AP layer execution management module 480, a DB layer execution management module 482, a data management module 484, a memory area management module 486, a library 488, and a transaction management module 490.
The development/control program 40 uses those components to develop and debug a control program 44, which controls the server program 30, in accordance with operation performed by a user.
The development/control program 40 controls execution of the control program 44 to carry out database operation in the server program 30 and desired database-using services.
The UI module 400 in the development/control program 40 provides a user interface function to a user of the development/operation PC 4.
The UI module 400 also controls processing of each component of the development/control program 40 in accordance with operation performed by a user.
The program development assisting module 420 in the program developing module 42 assists development of the SQL-format control program 44 by a user (programmer).
An example of the control program 44 developed by the program development assisting module 420 will be described later with reference to
The debugger 422 provides a debugging function for the control program 44, including step execution of the control program 44 which is developed with the use of the program development assisting module 420 and other components.
The program development assisting module 420 creates the control program 44 as the one shown in
This control program 44 performs the same processing as the program shown as an example in
AS shown in
In processing of the activated application layer (S122), first, the unit of transaction is specified.
The transaction includes activating one or more kinds of database layer processing necessary to provide a service by the server 3 in the processing of the application layer (S122).
The example shown in
Continuous memory areas dedicated to processing in the transaction are secured in the memory 124 (
Data used in all kinds of processing included in transactions is stored and managed in memory areas secured specially for the respective transactions.
The thus secured memory areas also store a connection object necessary to connect with the database.
The stored connection object is used for processing as the need arises, and the need to hand over an argument is therefore eliminated.
Next, data base layer processing is activated sequentially for operations performed on the server 3 (the DB operations #1 and #2).
When these operations are finished, the processing of the application layer is ended.
In the processing of the database layer (S124), a connection to the database (the DBMS 302 and the database module 300 in
Then the processing for database operation that is activated by the processing of the application layer is executed.
Program modules performing processing for database operation are provided as program modules made into components and included in the library.
Results of the processing for database operation are committed to the database module 300, or the processing is cancelled and the transaction is rolled back.
As the processing for database operation is finished, the processing of the database layer is ended.
Execution of processing of the control program 44 shown in
Reference is made again to
In the execution control module 48, the UI/AP layer execution management module 480 interprets the user interface layer program and application layer program of the control program 44, and manages execution of processing of these programs in each transaction.
The DB layer execution management module 482 interprets the database layer program of the control program 44, and manages execution of the database layer program in each transaction.
The memory area management module 486 secures and manages memory areas (
The memory area management module 486 also frees memory areas of a transaction that has finished processing.
The data management module 484 manages data stored in memory areas in processing of respective transactions.
The library 488 provides program modules that perform processing of the database layer and are made into components.
The transaction management module 490 manages a transaction defined in the application layer.
The UI layer control module 460 and the AP layer control module 462 controls processing of the service providing module 304 of the server program 30 (
The DB layer control module 464 controls processing of the DBMS 302 and of the database module 300 under the management of the DB layer execution management module 482.
A further description will be given with reference to
In
As shown in
The service providing module 304 outputs the press detection result of the button 5 to the UI/AP layer execution management module 480 via the UI layer control module 460 of the execution control module 48 (
The UI/AP layer execution management module 480 receives the press detection result of the button 5.
In Step 102 (S202), the UI/AP layer execution management module 480 (
The program execution control module 46 proceeds to processing of S200 in the case where the press of the button 5 is detected, and returns to the processing of S200 in any other cases.
In Step 200 (S200), the UI/AP layer execution management module 480 (
A transaction is specified from a class declaration part of the application layer.
This part is referred to when processing of connecting to the server 3 is performed, and its operation is changed accordingly.
The memory area management module 486 secures and manages memory areas used for processing of the defined transaction.
The data management module 484 manages data stored in the secured memory areas.
The transaction management module 490 manages the defined transaction.
In Step 202 (S202), the UI/AP layer execution management module 480 (
The database layer program for the first processing is provided by the library 488 as a program module that is made into components.
The activated database layer program is interpreted by the DB layer execution management module 482, which establishes a connection to the database and opens the database.
In Step 204 (S204), the DB layer execution management module 482 (
In Step 206 (S206), the DB layer execution management module 482 judges a returned value from the database to determine whether or not the processing executed in S204 is a success.
The program execution control module 46 proceeds to processing of S208 in the case where the processing is a success, and moves to processing of S114 in any other cases.
In Step 208 (S208), the UI/AP layer execution management module 480 (
The database layer program for the second processing is, similarly to the program for the first processing, provided by the library 488 as a program module that is made into components.
In Step 110 (S110), the DB layer execution management module 482 (
The program execution control module 46 proceeds to processing of S112 in the case where the processing is a success, and moves to the processing of S114 in any other cases.
In Step 112 (S112), the DB layer execution management module 482 (
In Step 114 (S114), the DB layer execution management module 482 cancels an operation performed on the database, rolls back the operation, and sends the processing results and a returned value to the UI/AP layer execution management module 480.
In Step 116 (S116), the DB layer execution management module 482 cuts the connection with the database and closes the database via the data management module 484.
The UI/AP layer execution management module 480 controls the service providing module 304 via the UI layer control module 460 and the AP layer control module 462 in accordance with the processing results and the returned value that are entered by the DB layer execution management module 482, to make the service providing module 304 perform necessary processing such as displaying the processing results on the input/output device 126 (
The memory area management module 486 frees the memory areas and the transaction management module 490 performs processing of ending the transaction.
In the processing of the program shown in
The processing of the control program 44 shown in
As shown in
Therefore, with the development/control program 40, the user interface layer of the control program 44 can be debugged by the same debugger 422 that is used to debug the application layer and the database layer.
Since the use of the development/control program 40 eliminates the need to debug the user interface layer with a different debugger from the one used in debugging of the application layer and the database layer as shown in
While the control program 44 shown in
Also, in processing activated by one transaction (e.g., T1-1), more transactions (e.g., T2-1 to T2-3) may be defined.
The program execution control module 46 (
The present invention is applicable to database operation.
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/JP04/00521 | 1/22/2004 | WO | 00 | 1/23/2008 |