Computer-based devices for database communication
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-01
- Publication Date
- 2026-08-14
AI Technical Summary
由于上述技术问题,这两种传统的数据库操作方法都不能满足敏捷开发模式中的进度和质量要求
[0018]提出的用于数据库通信的基于计算机的装置可以解决传统软件开发过程的上述数据库操作问题。由于在应用侧上的第一计算机系统中提供业务代码,所以应用业务代码中不包含数据库连接信息和数据库操作逻辑。相反,业务代码和数据库操作代码存在于相应的、单独的代码文件和配置文件中。具体地,应用侧的业务代码存在于第一计算机系统中并且数据库操作代码——即代码文件和配置文件——存在于第二计算机系统中。
Smart Images

Figure CN114787794B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to a computer-based apparatus for database communication, wherein access to a database by a computer system is controlled. Background Technology
[0002] In traditional software development, there are typically two ways to operate on a software system's database. One approach is to record / include database connection information—such as database IP address, username, password, and port—and database operation logic—such as SQL statements—in the software's business logic code. The other approach is to provide a separate database operation module. In this case, the database connection information will exist in plaintext format in the database operation module's configuration file, and the database operation logic will reside within the business logic code of the database operation module.
[0003] In complex software systems, these two traditional database operations are not easily applied to extended business logic code. Furthermore, due to the relatively high coupling between business logic code and database operation code, the described methods of known database operations are largely inflexible. Therefore, business developers have to write complex SQL statements for database operations when writing business logic code. Consequently, the technical requirements for business developers—i.e., database expertise—are relatively high, and code development is difficult. In addition, the development cycle is long, and it is often difficult to achieve the intended development goals.
[0004] In addition, in these two traditional database operation methods, database connection information and database logic are exposed to software business code or configuration files. This poses a potential risk to data security.
[0005] As agile development becomes increasingly prevalent in software methodologies, the demands for software delivery schedules and quality will become more stringent. Due to the aforementioned technical challenges, neither of these two traditional database operation methods can meet the schedule and quality requirements of agile development.
[0006] The aim is to provide a computer-based device for database communication in which a high degree of decoupling and encapsulation between the computer system and the database is ensured. Summary of the Invention
[0007] The problem this invention aims to solve is to provide a computer-based device for database communication that allows for a high degree of decoupling between business code provided on a first computer system (application side) and database operation code provided on a second computer system (data service side). High architectural flexibility is also desired.
[0008] The solution to this problem is described in the independent claims. The dependent claims relate to further improvements to the invention.
[0009] One embodiment of a computer-based apparatus for database communication includes a first computer system for executing at least one application, and a second computer system for providing at least one database and data for evaluating said at least one database. The first and second computer systems are configured to communicate with each other. The second computer system is configured to encapsulate said at least one database to prevent direct access by the first computer system to said at least one database.
[0010] A first computer system is configured to send a communication request to a second computer system. The second computer system is configured to evaluate the communication request and, in response, access data in the at least one database. The second computer system is configured to process the data in the at least one database by performing data operations and provide results from these data operations. The second computer system is configured to return response data to the first computer system in response to the results from the data operations.
[0011] According to one possible implementation of the computer-based device, the second computer system may include a reverse proxy server configured to receive communication requests from the first computer system.
[0012] According to another embodiment of the computer-based device, the second computer system may include a database server configured to encapsulate programs and functions stored in the database to prevent the first computer system from performing any database operations and directly accessing the raw data of the at least one database. Any database operation logic can be encapsulated within the programs and functions stored in the database.
[0013] In one implementation, communication is stateless. Both the first and second computer systems may contain software architectures configured to use stateless communication. There may be no background information about the first computer system stored on the second computer system between multiple requests. Each request from the first computer system may contain all the information necessary to service that request, and session state is maintained on the first computer system. Session state can be transferred by the second computer system to another service, such as a database, to maintain persistent state over time and allow authentication. This stateless architecture allows switching between different second computer systems (or different computers within the second computer system) and using different reverse proxy servers, providing further decoupling between the first and second computer systems.
[0014] According to another embodiment of the computer-based device, the second computer system may include a data encapsulation server configured to execute programs stored on a database server. The database server may be configured to provide data operation execution results to the encapsulation server. Furthermore, the encapsulation server may be configured to encapsulate the data operation execution results and return the encapsulated data operation execution results to a reverse proxy server. Any database connection information may be stored in a configuration file on the encapsulation server. The reverse proxy server may be configured to return the encapsulated data operation execution results as response data to the first computer system.
[0015] Computer systems can be configured to use the Representational State Transition (REST) software architecture style.
[0016] According to a preferred embodiment of the computer-based device, the first computer system can be configured to communicate with the second computer system by sending HTTP requests to the reverse proxy server. Specifically, the first computer system can be configured to send HTTP requests to the reverse proxy server using a RESTful API communication architecture.
[0017] According to one possible implementation of a computer-based device, a reverse proxy server can be configured to parse HTTP requests and translate them into database requests. The database requests are configured to provide access to one of the programs storing a database. The reverse proxy server is configured to forward the database requests to a wrapper server.
[0018] The proposed computer-based device for database communication solves the aforementioned database operation problems in traditional software development processes. Since the business code is provided on the first computer system on the application side, the application business code does not contain database connection information or database operation logic. Instead, the business code and database operation code reside in corresponding, separate code files and configuration files. Specifically, the application-side business code resides in the first computer system, and the database operation code—i.e., the code files and configuration files—resides in the second computer system.
[0019] Therefore, adding / modifying code on one side / computer system will not affect code on the other side / computer system. Thus, the proposed computer-based device for database communication provides a high degree of decoupling between business code on the application side of the first computer system and database operation code on the data service side of the second computer system.
[0020] According to the proposed computer-based device for database communication, the application side implemented on the first computer system and the database service side implemented on the second computer system are completely isolated, making the database operation logic completely hidden and invisible to the application business side. Specifically, the application business code on the first computer system does not contain database operation logic, and all database operation logic on the second computer system is encapsulated in programs and functions stored in the database. Database connection information may only be provided on the data encapsulation server.
[0021] The only way to access the database from the application side—that is, the primary computer system—is by sending communication requests, such as calls to a RESTful API. Except for using a data encapsulation server that is invisible from the application side of the primary computer system, the backend database server / database instance server can only communicate with the data encapsulation server to ensure data security.
[0022] The second computer system on the data service side may include multiple reverse proxy servers and wrapper servers. Furthermore, it's possible to configure and bind various logics of a RESTful API to different wrapper servers on the reverse proxy servers. Multiple database servers may also be deployed to handle the same data business using a master-slave model.
[0023] In summary, the computer-based device for database communication perfectly supports database service load balancing and high availability. Furthermore, multiple database servers can be deployed, splitting database read and write operations across different databases and reducing database pressure. In addition, the proposed computer-based device provides support for microservices and SOA architectures, as well as cloud server architectures.
[0024] When an application has database operation requirements, a computer-based device for database communication allows adding / modifying stored programs within the database and modifying configuration files on a reverse proxy server to establish any mapping between the new RESTful API and the database-stored programs. Therefore, any development work can be completed on the database service layer, implemented on a second computer system on the data service side.
[0025] When working with the proposed computer-based device for database communication, application developers only need to focus on the business code used in the first computer system on the application side. They do not need to worry about the database service layer implementation on the second computer system. All database service layer operations can be implemented by specialized database developers. The ability for application code developers and database developers to work in parallel allows the computer-based device for database communication to perfectly meet schedule and quality requirements within an agile development paradigm.
[0026] Additional features and advantages are set forth in the detailed description below. It should be understood that the foregoing general description and the following detailed description are merely exemplary and intended to provide an overview or framework for understanding the nature and characteristics of the claims. Detailed Implementation
[0027] The invention will now be described by way of example of embodiments without limiting its general inventive concept, with reference to the accompanying drawings.
[0028] The accompanying drawings illustrate one embodiment of a proposed computer-based device 1 for database communication, which includes a first computer system on the application side and a second computer system for implementing a data service side.
[0029] The accompanying drawings illustrate a first computer system 10 for executing at least one application, and a second computer system 20 for providing at least one database 300a, 300b, and 300c and for evaluating data from at least one database. The first computer system 10 and the second computer system 20 are configured to communicate with each other. Specifically, the second computer system 20 on the data service side is configured to encapsulate at least one database 300a, 300b, and 300c to prevent the first computer system 10 on the application side from direct access to at least one database—especially any raw data from at least one database.
[0030] The first computer system 10 is configured to send a communication request to the second computer system 20. The second computer system 20 is configured to evaluate the communication request and, in response, access data in at least one database 300a, 300b, and 300c. The second computer system 20 is configured to process the data in at least one database 300a, 300b, and 300c by performing data operations and to provide the results of the data operation execution. The second computer system 20 is configured to return response data to the first computer system 10 in response to the results of the data operation execution.
[0031] The application side implemented on the first computer system 10 refers to a series of applications that need to access the database. According to the proposed computer-based device 1 for database communication, the application side communicates with the database server side through communication requests sent from the first computer system 10 to the second computer system 20 or through response data sent from the second computer system 20 to the first computer system 10.
[0032] The second computer system 20 includes a reverse proxy server 100 configured to receive communication requests from the first computer system 10. The first computer system 10 can be configured to communicate with the second computer system 20 by sending HTTP requests to the reverse proxy server 100. Specifically, the first computer system 10 can send HTTP requests to the reverse proxy server 100 using a RESTful API communication architecture.
[0033] The second computer system 20 also includes a database server 300, which is configured to encapsulate programs and functions stored in the database to prevent direct access by the first computer system 10 to any database operations. Any database operation logic is encapsulated within programs and functions stored in the database that are inaccessible to the first computer system 10—the application side.
[0034] The second computer system 20 also includes a data encapsulation server 200, which is configured to execute programs stored in the database on the database server 300. Specifically, the database server 300 is configured to provide data operation execution results to the encapsulation server 200. The encapsulation server 200 is configured to encapsulate the data operation execution results and return the encapsulated data operation execution results to the reverse proxy server 100. The reverse proxy server 100 is configured to return the encapsulated data operation execution results as response data to the first computer system 10.
[0035] The following describes an example communication process between the first computer system 10 on the application side and the second computer system 20 on the data service side.
[0036] As explained above, the first computer system 10 on the application side can communicate with the second computer system 20 on the database service side via a RESTful API. For example, the first computer system 10 on the application side initiates an HTTP request to the reverse proxy server 100 via the RESTful API.
[0037] Specifically, the reverse proxy server 100 converts RESTful communication requests from the first computer system 10 into easily processed database package / database storage program requests, and then forwards the converted requests to the data encapsulation service provided by the data encapsulation server 200. Specifically, the reverse proxy server 100 receives HTTP requests from the first computer system 10 on the application side, parses the HTTP requests and repackages them into another HTTP / WSGI / UWSGI request, and then forwards the new HTTP / WSGI / UWSGI to the data encapsulation server 200 for further processing.
[0038] Data encapsulation server 200 connects to database server 300 to execute database-stored programs. Specifically, data encapsulation server 200 receives HTTP requests from reverse proxy server 100. It parses the HTTP method, the database-stored program name, and the corresponding parameter values in the request string. Then, data encapsulation server 200 uses database connection configuration information to execute the database-stored program on database server 300. The data encapsulation service provided by data encapsulation server 200 bridges the connection between RESTful requests and the database.
[0039] Database server 300 returns the data operation execution result to data encapsulation server 200. In the next step, the data processing program implemented on data encapsulation server 200 encapsulates the execution result into a unified data format, such as JSON format, and returns the encapsulated data operation execution result to reverse proxy server 100. The data processing program on data encapsulation server 200 needs to include several modules, such as a database connection module, an exception handling module, a parameter parsing module, a database storage program execution module, and a database execution result processing module (processing into RESTful JSON format). Reverse proxy server 100 returns the encapsulated data operation execution result (e.g., JSON format data) as response data to the first computer system 10 on the application side.
[0040] Reverse proxy server 100 can be deployed within open-source reverse proxy software. The software used can be Nginx or Apache. Reverse proxy server 100 is implemented to forward HTTP requests from the application to the target server (data encapsulation server 200). All configurations on reverse proxy server 100 can reside in configuration files.
[0041] The data encapsulation server 200 will be deployed on an open-source UWSGI service, which is a custom data processing program that supports UWSGI and HTTP protocols. The data processing program can be developed using C, C++, Java, C#, Python, Go, or other languages. Connection and login information for the database server 300 will be recorded in a configuration file on the data encapsulation server 200. The data encapsulation server 200 interacts directly with the database server 300 to execute data manipulation requests. According to one possible implementation, the data encapsulation server 200 will encapsulate any database return results as a JSON string.
[0042] Database server 300 will be deployed as the database system. Candidate database systems include Oracle, MySQL, and SQL Server. All database operations from the application side will be encapsulated within programs and functions stored in the database. All database operations will be invisible to the application side. Database operations can include commands such as SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, TRUNCATE, RENAME, ALTER, AUDIT, GRANT, COMMIT, and ROLLBACK.
Claims
1. A first computer system for executing at least one application program and configured to: A communication request is sent from the first computer system to the second computer system, wherein the first computer system is configured to provide business code, the business code not including database operation logic, and the database operation logic including SQL statements. Receive the encapsulated data operation execution result from the second computer system, wherein... The execution result of the encapsulated data operation is based on the execution of programs and functions stored in the database that encapsulate the database operation logic, which is not visible to the first computer system; as well as The at least one application is executed based on the results of the encapsulated data operations.
2. The first computer system according to claim 1, wherein, The communication request is an HTTP request.
3. The first computer system of claim 2, wherein the first computer system is configured to send the HTTP request to the second computer system using a RESTful API communication architecture.
4. The first computer system according to any one of claims 1 to 3, wherein the first computer system comprises a software architecture configured to use stateless communication.
5. The first computer system according to any one of claims 1 to 3, wherein the communication request contains all the information required to serve the communication request, and the session state is stored in the first computer system.
6. A second computer system encapsulating at least one database, configured as follows: A communication request is received from a first computer system, which provides business code, the business code not including database operation logic, the database operation logic including SQL statements; Evaluate the communication request and access the data in response to the communication request to the at least one database; The program and functions of the database storage, which encapsulate database operation logic, are executed to generate data operation execution results, wherein the database operation logic is not visible to the first computer system; Encapsulate the results of the data operation; as well as Send the encapsulated data operation execution result to the first computer system.
7. The second computer system according to claim 6, The second computer system includes a reverse proxy server configured to receive the communication request from the first computer system.
8. The second computer system of claim 7, wherein the second computer system further comprises a database server configured to encapsulate programs and functions stored in the database.
9. The second computer system according to claim 6, The second computer system further includes a data encapsulation server configured to execute programs stored in the database on the database server.
10. The second computer system of claim 9, wherein the database server is configured to provide the data operation execution results to the data encapsulation server.
11. The second computer system of claim 10, wherein the data encapsulation server is configured to encapsulate the data operation execution result and return the encapsulated data operation execution result to the reverse proxy server.
12. The second computer system according to claim 9, wherein the database connection information is stored in a configuration file on the data encapsulation server.
13. The second computer system of claim 11, wherein the reverse proxy server is configured to return the encapsulated data operation execution result as response data to the first computer system.
14. The second computer system of claim 7, wherein the reverse proxy server is configured to communicate with the first computer system by receiving the communication request from the first computer system, the communication request being an HTTP request.
15. The second computer system of claim 14, wherein the reverse proxy server is configured to receive the HTTP request from the first computer system using a RESTful API communication architecture.
16. The second computer system according to claim 14 or 15, The reverse proxy server is configured to parse the HTTP request and convert it into a database request. The reverse proxy server is configured to forward the database request to a wrapper server configured to execute a program for storing the database. The database request is configured to provide access to one of the programs stored in the database.
17. The second computer system of claim 6, wherein the second computer system comprises a software architecture configured to use stateless communication.
18. The second computer system of claim 6, wherein the communication request from the first computer system contains all the information required to serve the communication request.
Citation Information
Patent Citations
Method accessing data bank through protocol agency mode
CN1494022A
BRIDGING NATIVE JDBC CALLS WITH DBaaS USING ESB
US20180129706A1