CN117112049A - Data source management method, device, computer equipment and storage medium - Google Patents

Data source management method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN117112049A
CN117112049A CN202310854319.XA CN202310854319A CN117112049A CN 117112049 A CN117112049 A CN 117112049A CN 202310854319 A CN202310854319 A CN 202310854319A CN 117112049 A CN117112049 A CN 117112049A
Authority
CN
China
Prior art keywords
application system
type
data source
code
application
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310854319.XA
Other languages
Chinese (zh)
Inventor
李鹏飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Bank of China Ltd
Original Assignee
Bank of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN202310854319.XA priority Critical patent/CN117112049A/en
Publication of CN117112049A publication Critical patent/CN117112049A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application relates to a data source management method, a device, computer equipment and a storage medium, wherein the method is characterized in that by determining the type of an application system to be configured, if the type of the application system is the type of container release, a first function module of data source configuration is extracted and generated from an application program corresponding to the application system, a container corresponding to the application system is generated according to the first function module, a plurality of data sources corresponding to the application system are configured by executing the container in the process of starting the application system, and if the type of the application system is the type of direct operation, a second function module of data source configuration is extracted and packaged from the application program corresponding to the application system, and the plurality of data sources corresponding to the application system are configured by executing the second function module in the process of starting the application system. According to the method, the first functional module is obtained through extraction or the second functional module is obtained through encapsulation, so that the efficiency of data source configuration is improved.

Description

Data source management method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of database technologies, and in particular, to a method and apparatus for managing a data source, a computer device, and a storage medium.
Background
With the rapid development of financial technology, banks are continuously introducing and applying new technologies to improve service efficiency and quality. The background application system plays a key role in the financial field and is responsible for managing various financial data, providing stable and reliable data support for front-end business application, wherein the data comprise customer information, account data, transaction records, loan information, risk assessment and the like. In order to efficiently manage and utilize the data, the financial institutions widely apply database technology, and in the process of interaction between a background application system and a database, configuration of a data source becomes a very critical step, and the data source is a bridge between the background application system and the database and is used for providing functions such as database connection and data operation.
Currently, a large-scale application system may include hundreds of micro-service modules, and the number of databases increases with the increase of the micro-service modules, and when the application system interacts with a plurality of databases, a plurality of data sources need to be configured in each micro-service module to realize data interaction between each micro-service module and the plurality of databases.
Therefore, the above-mentioned data source configuration method has a problem of low efficiency.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a data source management method, apparatus, computer device, and storage medium that can improve configuration efficiency.
In a first aspect, the present application provides a method for managing a data source, the method comprising:
determining the type of an application system to be configured;
if the type of the application system is the type of the container release, a first functional module of data source configuration is extracted and generated from an application program corresponding to the application system, a container corresponding to the application system is generated according to the first functional module, and a plurality of data sources corresponding to the application system are configured by executing the container in the process of starting the application system;
and if the type of the application system is a direct running type, extracting and packaging a second function module configured by the data sources from the application program corresponding to the application system, and configuring a plurality of data sources corresponding to the application system by executing the second function module in the process of starting the application system.
In one embodiment, an application program corresponding to an application system includes a plurality of micro service codes, and a first function module for extracting and generating a data source configuration from the application program corresponding to the application system includes:
Extracting a first data source configuration code from each microservice code;
and performing de-duplication processing on all the extracted first data source configuration codes, and integrating to generate a first functional module.
In one embodiment, the application program corresponding to the application system includes a plurality of micro service codes, and the second function module for extracting and encapsulating the data source configuration from the application program corresponding to the application system includes:
extracting a second data source configuration code from each micro-service code;
and performing de-duplication processing on all the extracted second data source configuration codes, and packaging to generate a second functional module.
In one embodiment, generating a container corresponding to an application system according to a first functional module includes:
adding an interface configuration code into an application program corresponding to the application system after the first functional module is extracted; the interface configuration code is used for configuring the interaction interface between the container and the database;
and generating a container corresponding to the application system according to the application program added with the codes and the first functional module.
In one embodiment, the first functional module includes configuration code for a plurality of first data sources; the configuration code of each first data source comprises a first loading database driver, a first connecting database program, a first interaction program and a first closing database connection releasing program; the first interactive program is used for indicating the first functional module to execute the database statement by the application system after the database connection is acquired.
In one embodiment, the second functional module includes configuration code for a plurality of second data sources; the configuration code of each second data source comprises a configuration environment information code, a second loading database driver, a second connection database program, a second interaction program and a second closing database connection releasing program; the second interactive program is used for indicating the second functional module to execute the database statement by the application system after the database connection is acquired.
In one embodiment, determining the type of application system to be configured includes:
determining the type of the corresponding execution code of the application system; the types of the execution codes comprise war execution code types and jar execution code types;
the type of the war execution code is determined to be the type of the container issue, and the type of the jar execution code is determined to be the type of direct operation.
In a second aspect, the present application also provides a device for managing a data source, where the device includes:
the determining module is used for determining the type of the application system to be configured;
the first configuration module is used for extracting and generating a first function module of data source configuration from an application program corresponding to the application system if the type of the application system is the type of the container release, generating a container corresponding to the application system according to the first function module, and configuring a plurality of data sources corresponding to the application system by executing the container in the process of starting the application system;
And the second configuration module is used for extracting and packaging the second function module configured by the data sources from the application programs corresponding to the application system if the type of the application system is a direct running type, and configuring a plurality of data sources corresponding to the application system by executing the second function module in the process of starting the application system.
In a third aspect, the present application also provides a computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
determining the type of an application system to be configured;
if the type of the application system is the type of the container release, a first functional module of data source configuration is extracted and generated from an application program corresponding to the application system, a container corresponding to the application system is generated according to the first functional module, and a plurality of data sources corresponding to the application system are configured by executing the container in the process of starting the application system;
and if the type of the application system is a direct running type, extracting and packaging a second function module configured by the data sources from the application program corresponding to the application system, and configuring a plurality of data sources corresponding to the application system by executing the second function module in the process of starting the application system.
In a fourth aspect, the present application also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
determining the type of an application system to be configured;
if the type of the application system is the type of the container release, a first functional module of data source configuration is extracted and generated from an application program corresponding to the application system, a container corresponding to the application system is generated according to the first functional module, and a plurality of data sources corresponding to the application system are configured by executing the container in the process of starting the application system;
and if the type of the application system is a direct running type, extracting and packaging a second function module configured by the data sources from the application program corresponding to the application system, and configuring a plurality of data sources corresponding to the application system by executing the second function module in the process of starting the application system.
In a fifth aspect, the application also provides a computer program product comprising a computer program which, when executed by a processor, performs the steps of:
determining the type of an application system to be configured;
If the type of the application system is the type of the container release, a first functional module of data source configuration is extracted and generated from an application program corresponding to the application system, a container corresponding to the application system is generated according to the first functional module, and a plurality of data sources corresponding to the application system are configured by executing the container in the process of starting the application system;
and if the type of the application system is a direct running type, extracting and packaging a second function module configured by the data sources from the application program corresponding to the application system, and configuring a plurality of data sources corresponding to the application system by executing the second function module in the process of starting the application system.
The method comprises the steps of determining the type of an application system to be configured, extracting and generating a first function module of data source configuration from an application program corresponding to the application system if the type of the application system is the type of container release, generating a container corresponding to the application system according to the first function module, configuring a plurality of data sources corresponding to the application system by executing the container in the process of starting the application system, extracting and packaging a second function module of data source configuration from the application program corresponding to the application system if the type of the application system is the type of direct operation, and configuring the plurality of data sources corresponding to the application system by executing the second function module in the process of starting the application system. According to the method, the first functional module is obtained by extracting the function of the data source configuration or is packaged into the second functional module, so that the computer equipment does not need too much information of the configuration data source in the code when the data source configuration is carried out on the application system, only the first functional module or the second functional module is needed to be executed, one-time development and multiple-time multiplexing are realized, and the efficiency of the data source configuration is improved. Moreover, when the environment or parameters of the data source need to be changed, only the first functional module or the second functional module needs to be modified, and no change is needed to be made to the codes of the application system, so that the flexibility is greatly improved.
Drawings
FIG. 1 is an internal block diagram of a computer device in one embodiment;
FIG. 2 is a flow diagram of a method of managing data sources in one embodiment;
FIG. 3 is a flow chart of a method of managing data sources according to another embodiment;
FIG. 4 is a flow chart of a method of managing data sources according to another embodiment;
FIG. 5 is a flow chart of a method of managing data sources according to another embodiment;
FIG. 6 is a flow chart of a method of managing data sources according to another embodiment;
FIG. 7 is a flow chart of a method of managing data sources according to another embodiment;
fig. 8 is a block diagram of a management apparatus for data sources in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
With the rapid development of financial technology, banks are continuously introducing and applying new technologies to improve service efficiency and quality. The background application system plays a key role in the financial field and is responsible for managing various financial data, providing stable and reliable data support for front-end business application, wherein the data comprise customer information, account data, transaction records, loan information, risk assessment and the like. In order to efficiently manage and utilize the data, the financial institutions widely apply database technology, and in the process of interaction between a background application system and a database, configuration of a data source becomes a very critical step, and the data source is a bridge between the background application system and the database and is used for providing functions such as database connection and data operation.
Currently, a large-scale application system may include hundreds of micro-service modules, and the number of databases increases with the increase of the micro-service modules, and when the application system interacts with a plurality of databases, a plurality of data sources need to be configured in each micro-service module to realize data interaction between each micro-service module and the plurality of databases. Because the data source configuration codes are coupled with the application system codes, for the application system, a plurality of data sources need to be repeatedly configured in the micro-service deployment module, which is not beneficial to multiplexing and centralized management of the data sources, and the number of databases is increased along with the increase of the micro-service modules, so that great challenges are brought to the logic of interaction of the plurality of data sources. Therefore, the above-mentioned data source configuration method has a problem of low efficiency. The present application provides a method for managing a data source, which aims to solve the above technical problems, and the following embodiments specifically describe the method for managing a data source according to the present application.
The data source management method provided by the embodiment of the application can be applied to the computer equipment shown in the figure 1. The computer device may be a terminal, comprising a processor, a memory, an input/output interface, a communication interface, a display unit and an input means. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program, when executed by a processor, implements a method of managing a data source. The display unit of the computer device is used for forming a visual picture, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be a key, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the architecture shown in fig. 1 is merely a block diagram of some of the architecture relevant to the present inventive arrangements and is not limiting as to the computer device to which the present inventive arrangements may be implemented, as a particular computer device may include more or less components than those shown, or may be combined with some components, or may have a different arrangement of components.
In one embodiment, as shown in fig. 2, a method for managing a data source is provided, and the method is applied to the computer device in fig. 1 for illustration, and includes the following steps:
s201, determining the type of an application system to be configured, wherein the type of the application system comprises the type of container release and the type of direct operation, and if the type of the application system is the type of container release, executing step S202; if the type of the application system is a direct running type, step S203 is executed.
The type of the application system represents a deployment mode or an operation mode of the application system to be configured, and the type of the application system comprises a type of container release and a type of direct operation.
In the embodiment of the application, the computer equipment can firstly encode the source code of the application system to obtain the execution code, then judge the type of the execution code, and further determine the type of the application system. Specifically, the computer device may encode the source code of the application system into a war execution code or a jar execution code, if the execution code is the war execution code, determine the type of the application system corresponding to the war execution code as the type issued by the container, and if the execution code is the jar execution code, determine the type of the application system corresponding to the jar execution code as the type issued by the container. Optionally, the computer device may further determine a type of the application system to be configured according to the architecture and design document of the application system, and a deployment mode and an operation mode of the application system. Optionally, the computer device may also analyze the application itself in the application system and the requirements for data source configuration to further determine the application system type.
S202, if the type of the application system is the type of the container release, a first function module of data source configuration is extracted and generated from an application program corresponding to the application system, a container corresponding to the application system is generated according to the first function module, and a plurality of data sources corresponding to the application system are configured by executing the container in the process of starting the application system.
The first functional module is used for stripping codes corresponding to functions of realizing configuration of multiple data sources, interaction with a database and the like in the application system from the application system to the containers, and developing a module interacting with the database by using expansion points of the containers. The first functional module includes configuration code for a plurality of first data sources; the configuration code of each first data source comprises a first loading database driver, a first connecting database program, a first interaction program and a first closing database connection releasing program; the first interactive program is used for indicating the first functional module to execute the database statement by the application system after the database connection is acquired.
In the embodiment of the application, after the computer equipment determines the type of the application system to be configured based on the steps, the type of the application system to be configured can be further determined to be the type of the container release or the type of the direct operation. If the type of the application system is the type of the container release, the computer device may strip and extract codes corresponding to configuration functions of multiple data sources and codes corresponding to interaction functions of the database in the application program corresponding to the application system from the application system, further generate a first function module configured by the data sources, and then generate a container corresponding to the application system according to the first function module. When the computer equipment starts the application system, the extension point of the container can be used for directly executing codes corresponding to the container corresponding to the application system, specifically, the computer equipment starts to execute a first loading database driver, executes a program of a first connecting database after loading the database, executes a first interactive program after connecting the database, namely, executes SQL sentences by the application system, executes a program of first closing the database to release connection after the application system executes SQL, and finally closes the database to release connection, so that configuration work of configuring a plurality of data sources corresponding to the application system by the computer equipment is realized.
And S203, if the type of the application system is a direct running type, extracting and packaging a second function module for obtaining data source configuration from an application program corresponding to the application system, and configuring a plurality of data sources corresponding to the application system by executing the second function module in the process of starting the application system.
The second functional module is used for packaging codes corresponding to functions of realizing configuration of multiple data sources, interaction with a database and the like in the application system into a single data source management program. The second functional module includes configuration code for a plurality of second data sources; the configuration code of each second data source comprises a configuration environment information code, a second loading database driver, a second connection database program, a second interaction program and a second closing database connection releasing program; the second interactive program is used for indicating the second functional module to execute the database statement by the application system after the database connection is acquired; the configuration environment information comprises the URL, port, instance name, user name, password and the like of the database.
In the embodiment of the application, after the computer equipment determines the type of the application system to be configured based on the steps, the type of the application system to be configured can be further determined to be the type of the container release or the type of the direct operation. If the type of the application system is a direct running type, the computer device may extract a code corresponding to a configuration function of the multiple data sources in the application program corresponding to the application system and a code corresponding to an interaction function of the database from the application system, and further package the code to obtain a second function module configured by the data sources. When the computer equipment starts the application system, the codes of the plurality of data sources corresponding to the application system can be executed by executing the second functional module, specifically, the computer equipment firstly executes the configuration environment information codes, after the environment information codes are completed, the computer equipment starts to execute the second loading database driver, after the loading of the database is completed, the program of the second connecting database is executed, after the database is connected, the second interactive program is executed, namely, the application system executes the SQL sentence, after the application system executes the SQL, the program of the second closing database releases the connection is executed, and finally, the database releases the connection is closed, so that the configuration work of the computer equipment for the plurality of data sources corresponding to the application system is realized.
In the above method for managing data sources, the computer device determines the type of the application system to be configured, if the type of the application system is the type of the container release, extracts and generates the first function module of the data source configuration from the application program corresponding to the application system, generates the container corresponding to the application system according to the first function module, configures a plurality of data sources corresponding to the application system by executing the container in the process of starting the application system, and extracts and encapsulates the second function module of the data source configuration from the application program corresponding to the application system if the type of the application system is the type of direct operation, and configures a plurality of data sources corresponding to the application system by executing the second function module in the process of starting the application system. According to the method, the first functional module is obtained by extracting the function of the data source configuration or is packaged into the second functional module, so that the computer equipment does not need too much information of the configuration data source in the code when the data source configuration is carried out on the application system, only the first functional module or the second functional module is needed to be executed, one-time development and multiple-time multiplexing are realized, and the efficiency of the data source configuration is improved. Moreover, when the environment or parameters of the data source need to be changed, only the first functional module or the second functional module needs to be modified, and no change is needed to be made to the codes of the application system, so that the flexibility is greatly improved. In addition, the method also provides different data source configuration methods according to the types of the application systems, and the data source configuration problem of all the existing types of the application systems is considered, so that the application is wider.
In one embodiment, there is further provided a step of acquiring a first function module, where an application corresponding to an application system includes a plurality of micro service codes, as shown in fig. 3, and "the first function module that extracts and generates a data source configuration from the application corresponding to the application system" in step S202 includes:
s301, extracting a first data source configuration code from each micro service code.
The micro service code is a code corresponding to a micro service module in the application system.
In the embodiment of the application, the computer equipment can firstly open the code library corresponding to each micro-service module, find the file or module from which the data source configuration code needs to be extracted, and further determine the components, modules and interaction modes of the micro-service module by analyzing the architecture and design document of the micro-service module. The code of the micro-service module is then searched for keywords related to the data source configuration, such as database connections, data source configuration, data source initialization, etc., using a text editor or integrated development environment, which may appear in a configuration file, code annotation, or specific function or method. And finally, analyzing the code blocks containing the related keywords of the data source configuration according to the search result to obtain an analysis result, and extracting the part containing the data source configuration codes according to the analysis result to obtain a first data source configuration code. It should be noted that the code structure and implementation manner of each micro service module may be different, so when extracting the data source configuration code, appropriate adjustment and processing are required according to the specific situation, which is not limited in the embodiment of the present application.
S302, performing deduplication processing on all the extracted first data source configuration codes, and integrating to generate a first functional module.
In the embodiment of the present application, after the computer device extracts the first data source configuration code from each micro service code based on the above steps, the first data source configuration codes extracted from each micro service module may be sorted and collected, and placed under the same folder or directory. To facilitate processing and integration, to ensure that all of the first data source configuration codes have the same format and naming convention, the codes may optionally be unified using the same encoding convention and naming convention. The repeated code segments may then be found using a text comparison tool or other code analysis function to compare and analyze all of the first data source configuration codes, identifying and removing the repeated portions. Finally, according to the needs and actual conditions, the codes can be properly organized and modularized according to the architecture and design of the micro-module service, and then the rest of the data source configuration codes are integrated into one file or module to form a first functional module. Optionally, in the first functional module integrally generated, necessary notes and documents may be added to provide instructions and instructions for the code to facilitate understanding and reference for subsequent maintenance and use. It should be noted that the code structure and implementation manner of each micro service module may be different, so that in the first functional module, the steps in this embodiment need to be appropriately adjusted and processed according to the specific situation, which is not limited in this embodiment of the present application.
In the above embodiment, by extracting the first data source configuration code from each micro service code and performing deduplication processing and integration on the extracted code to generate the first functional module, repeated labor can be avoided, unified management and maintenance can be performed, the risk of configuration errors can be reduced, the configuration speed can be increased, and consistency and normalization can be maintained, so that the configuration efficiency of the data source can be improved.
In an embodiment, there is further provided a step of obtaining a second function module, where an application program corresponding to an application system includes a plurality of micro service codes, as shown in fig. 4, and "the second function module configured by extracting and encapsulating a data source from the application program corresponding to the application system" in step S203 includes:
s401, extracting a second data source configuration code from each micro service code.
In the embodiment of the application, the computer equipment can firstly open the code library corresponding to each micro-service module, find the file or module from which the data source configuration code needs to be extracted, and further determine the components, modules and interaction modes of the micro-service module by analyzing the architecture and design document of the micro-service module. The code of the micro-service module is then searched for keywords related to the data source configuration, such as database connections, data source configuration, data source initialization, etc., using a text editor or integrated development environment, which may appear in a configuration file, code annotation, or specific function or method. And finally, analyzing the code blocks containing the related keywords of the data source configuration according to the search result to obtain an analysis result, and extracting the part containing the data source configuration codes according to the analysis result to obtain a second data source configuration code. It should be noted that the code structure and implementation manner of each micro service module may be different, so when extracting the data source configuration code, appropriate adjustment and processing are required according to the specific situation, which is not limited in the embodiment of the present application.
S402, performing de-duplication processing on all the extracted second data source configuration codes, and packaging to generate a second functional module.
In the embodiment of the present application, after the computer device extracts the second data source configuration code from each micro service code based on the above steps, the second data source configuration codes extracted from each micro service module may be sorted and collected, and placed under the same folder or directory. To facilitate processing and integration, to ensure that all of the first data source configuration codes have the same format and naming convention, the codes may optionally be unified using the same encoding convention and naming convention. The repeated code segments may then be found using a text comparison tool or other code analysis function to compare and analyze all of the second data source configuration codes, identifying and removing the repeated portions. Finally, according to the needs and actual conditions, the codes can be properly organized and modularized according to the architecture and design of the micro-module service, and then the rest of the data source configuration codes are packaged into one file or module to form a second functional module. Optionally, in the second functional module generated by the package, necessary notes and documents can be added to provide instructions and instructions for the code to facilitate understanding and reference for subsequent maintenance and use. It should be noted that the code structure and implementation manner of each micro service module may be different, so in the second functional module, the steps in this embodiment need to be appropriately adjusted and processed according to the specific situation, which is not limited in this embodiment of the present application.
In the above embodiment, by extracting the configuration code of the second data source from each micro service code and performing deduplication processing and encapsulation on the extracted code to generate the first functional module, repeated labor can be avoided, unified management and maintenance can be performed, the risk of configuration errors can be reduced, the configuration speed can be increased, and the consistency and normalization can be maintained, so that the configuration efficiency of the data source can be improved.
In an embodiment, there is further provided a step of obtaining a container corresponding to an application system, as shown in fig. 5, in the step S202, the "generating a container corresponding to an application system according to a first functional module" includes:
s501, adding an interface configuration code into an application program corresponding to the application system after the first functional module is extracted.
The interface configuration code is used for configuring the interaction interface between the container and the database.
In the embodiment of the present application, after the computer device extracts and generates the first function module of the data source configuration from the application program corresponding to the application system based on the above steps, the first function module may be used as a basis of the application system, and the interaction interface between the container and the database may be configured according to the need, and the interface configuration code may be added, so that, according to the different database types and access manners, relevant configurations may be performed for the database connection, the Data Access Object (DAO), the data source, and the like, where these configurations generally include information such as a database URL, a user name, a password, and the like.
S502, generating a container corresponding to the application system according to the application program added with the codes and the first functional module.
In the embodiment of the application, after the computer equipment adds the interface configuration code based on the steps, a proper container can be selected according to the requirements and the architecture of an application system, the common container is Tomcat, jboss, websphere, and the like, and the installation and the basic configuration of the container can be carried out according to the installation and the configuration document of the container. Then, the container installation package can be downloaded, the file can be decompressed, and after the system has met the operation requirements of the container, the container can be installed according to the installation document of the selected container, and the container can be configured according to the requirements of the application program and the first functional module. Finally, the application program is deployed into the container, specifically by packaging the application program code into a WAR file or compiling the source code into an executable program, and then copying the packaged file to a specific directory of the container or using a container management interface.
In the embodiment, the data interaction interface can be provided by adding the interface configuration code and generating the container corresponding to the application system, so that the efficiency of data source configuration is improved, good interaction between the container and the database is realized, and the performance of the system is improved.
In one embodiment, there is further provided a step of acquiring a type of an application system, as shown in fig. 6, the "determining a type of an application system to be configured" in the above step S201 includes:
s601, determining the type of the corresponding execution code of the application system.
The executable code represents an executable binary file obtained by source code encoding, and the types of the executable code comprise war executable code types and jar executable code types.
In the embodiment of the application, the computer equipment can firstly acquire the source code corresponding to the application system, wherein the source code comprises various functional modules, service logic and related configuration files. And compiling the source code according to the programming language and the development environment, namely converting the source code into the machine code of the specific target platform to generate the execution code, wherein the types of the execution code comprise the war execution code type and the jar execution code type.
S602, determining the type of the war executive code as the type of the container release, and determining the type of the jar executive code as the type of direct operation.
In the embodiment of the application, after the computer equipment obtains the type of the execution code corresponding to the application system based on the steps, the type of the war execution code can be determined as the type of the container release, and the type of the jar execution code can be determined as the type of direct operation.
In all the above embodiments, there is also provided a method for managing a data source, as shown in fig. 7, where the method includes:
s701, determining the type of the corresponding execution code of the application system, wherein the type of the execution code comprises the war execution code type and the jar execution code type.
S702, determining the type of the war executive code as the type of the container release, and determining the type of the jar executive code as the type of direct operation.
S703, if the type of the application system is the type of the container release, extracting a first data source configuration code from each micro service code.
S704, performing deduplication processing on all the extracted first data source configuration codes, and integrating to generate a first functional module.
S705, adding an interface configuration code into an application program corresponding to the application system after the first functional module is extracted; the interface configuration code is used to configure the interactive interface of the container with the database.
S706, generating a container corresponding to the application system according to the application program added with the codes and the first functional module.
S707, configuring a plurality of data sources corresponding to the application system through executing the container in the process of starting the application system. The first functional module includes configuration code for a plurality of first data sources; the configuration code of each first data source comprises a first loading database driver, a first connecting database program, a first interaction program and a first closing database connection releasing program; the first interactive program is used for indicating the first functional module to execute the database statement by the application system after the database connection is acquired.
S708, if the type of the application system is the type of direct running, extracting a second data source configuration code from each micro service code.
S709, performing de-duplication processing on all the extracted second data source configuration codes, and packaging to generate a second functional module.
S710, configuring a plurality of data sources corresponding to the application system by executing the second functional module in the process of starting the application system. The second functional module includes configuration code for a plurality of second data sources; the configuration code of each second data source comprises a configuration environment information code, a second loading database driver, a second connection database program, a second interaction program and a second closing database connection releasing program; the second interactive program is used for indicating the second functional module to execute the database statement by the application system after the database connection is acquired.
The method of each step is described in the foregoing embodiments, and the detailed description is referred to the foregoing description and is not repeated here.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a data source management device for realizing the above related data source management method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in the embodiments of the management device for one or more data sources provided below may refer to the limitation of the management method for a data source hereinabove, and will not be repeated herein.
In one embodiment, as shown in fig. 8, there is provided a management apparatus for a data source, including:
a determining module 10, configured to determine a type of an application system to be configured;
the first configuration module 11 is configured to extract and generate a first function module of data source configuration from an application program corresponding to the application system if the type of the application system is a type of container release, generate a container corresponding to the application system according to the first function module, and configure a plurality of data sources corresponding to the application system by executing the container in a process of starting the application system. Wherein the first functional module includes configuration codes of a plurality of first data sources; the configuration code of each first data source comprises a first loading database driver, a first connecting database program, a first interaction program and a first closing database connection releasing program; the first interactive program is used for indicating the first functional module to execute the database statement by the application system after the database connection is acquired.
And the second configuration module 12 is configured to extract and package the second function module configured by the data source from the application program corresponding to the application system if the type of the application system is a direct running type, and configure a plurality of data sources corresponding to the application system by executing the second function module in the process of starting the application system. Wherein the second functional module includes configuration code for a plurality of second data sources; the configuration code of each second data source comprises a configuration environment information code, a second loading database driver, a second connection database program, a second interaction program and a second closing database connection releasing program; the second interactive program is used for indicating the second functional module to execute the database statement by the application system after the database connection is acquired.
In one embodiment, the first configuration module 11 includes:
a first configuration unit for extracting a first data source configuration code from each micro service code;
and the first processing unit is used for carrying out de-duplication processing on all the extracted first data source configuration codes and integrating the extracted first data source configuration codes to generate a first functional module.
In one embodiment, the second configuration module 12 includes:
A second configuration unit for extracting a second data source configuration code from each micro service code;
and the second processing unit is used for carrying out de-duplication processing on all the extracted second data source configuration codes and packaging to generate a second functional module.
In one embodiment, the first configuration module 11 includes:
the adding unit is used for adding an interface configuration code into an application program corresponding to the application system after the first functional module is extracted; the interface configuration code is used for configuring the interaction interface between the container and the database;
and the generating unit is used for generating a container corresponding to the application system according to the application program added with the codes and the first functional module.
In one embodiment, the determining module 10 includes:
the first determining unit is used for determining the type of the corresponding execution code of the application system; the types of the execution codes comprise war execution code types and jar execution code types;
and the second determining unit is used for determining the type of the war execution code as the type of the container release and determining the type of the jar execution code as the type of direct operation.
The respective modules in the management apparatus of the data source described above may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program performing the steps of:
determining the type of an application system to be configured;
if the type of the application system is the type of the container release, a first functional module of data source configuration is extracted and generated from an application program corresponding to the application system, a container corresponding to the application system is generated according to the first functional module, and a plurality of data sources corresponding to the application system are configured by executing the container in the process of starting the application system; the first functional module includes configuration code for a plurality of first data sources; the configuration code of each first data source comprises a first loading database driver, a first connecting database program, a first interaction program and a first closing database connection releasing program; the first interactive program is used for indicating the first functional module to execute the database statement by the application system after the database connection is acquired.
If the type of the application system is a type of direct operation, extracting and packaging a second function module configured by the data sources from the application program corresponding to the application system, and configuring a plurality of data sources corresponding to the application system by executing the second function module in the process of starting the application system, wherein the second function module comprises configuration codes of the plurality of second data sources; the configuration code of each second data source comprises a configuration environment information code, a second loading database driver, a second connection database program, a second interaction program and a second closing database connection releasing program; the second interactive program is used for indicating the second functional module to execute the database statement by the application system after the database connection is acquired.
In one embodiment, the processor when executing the computer program further performs the steps of:
extracting a first data source configuration code from each microservice code;
and performing de-duplication processing on all the extracted first data source configuration codes, and integrating to generate a first functional module.
In one embodiment, the processor when executing the computer program further performs the steps of:
extracting a second data source configuration code from each micro-service code;
and performing de-duplication processing on all the extracted second data source configuration codes, and packaging to generate a second functional module.
In one embodiment, the processor when executing the computer program further performs the steps of:
adding an interface configuration code into an application program corresponding to the application system after the first functional module is extracted; the interface configuration code is used for configuring the interaction interface between the container and the database;
and generating a container corresponding to the application system according to the application program added with the codes and the first functional module.
In one embodiment, the processor when executing the computer program further performs the steps of:
determining the type of the corresponding execution code of the application system; the types of the execution codes comprise war execution code types and jar execution code types;
The type of the war execution code is determined to be the type of the container issue, and the type of the jar execution code is determined to be the type of direct operation.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
determining the type of an application system to be configured;
if the type of the application system is the type of the container release, a first functional module of data source configuration is extracted and generated from an application program corresponding to the application system, a container corresponding to the application system is generated according to the first functional module, and a plurality of data sources corresponding to the application system are configured by executing the container in the process of starting the application system; the first functional module includes configuration code for a plurality of first data sources; the configuration code of each first data source comprises a first loading database driver, a first connecting database program, a first interaction program and a first closing database connection releasing program; the first interactive program is used for indicating the first functional module to execute database sentences by the application system after acquiring the database connection;
if the type of the application system is a type of direct operation, extracting and packaging a second function module configured by the data sources from the application program corresponding to the application system, and configuring a plurality of data sources corresponding to the application system by executing the second function module in the process of starting the application system, wherein the second function module comprises configuration codes of the plurality of second data sources; the configuration code of each second data source comprises a configuration environment information code, a second loading database driver, a second connection database program, a second interaction program and a second closing database connection releasing program; the second interactive program is used for indicating the second functional module to execute the database statement by the application system after the database connection is acquired.
In one embodiment, the computer program when executed by the processor further performs the steps of:
extracting a first data source configuration code from each microservice code;
and performing de-duplication processing on all the extracted first data source configuration codes, and integrating to generate a first functional module.
In one embodiment, the computer program when executed by the processor further performs the steps of:
extracting a second data source configuration code from each micro-service code;
and performing de-duplication processing on all the extracted second data source configuration codes, and packaging to generate a second functional module.
In one embodiment, the computer program when executed by the processor further performs the steps of:
adding an interface configuration code into an application program corresponding to the application system after the first functional module is extracted; the interface configuration code is used for configuring the interaction interface between the container and the database;
and generating a container corresponding to the application system according to the application program added with the codes and the first functional module.
In one embodiment, the computer program when executed by the processor further performs the steps of:
determining the type of the corresponding execution code of the application system; the types of the execution codes comprise war execution code types and jar execution code types;
The type of the war execution code is determined to be the type of the container issue, and the type of the jar execution code is determined to be the type of direct operation.
In one embodiment, a computer program product is provided comprising a computer program which, when executed by a processor, performs the steps of:
determining the type of an application system to be configured;
if the type of the application system is the type of the container release, a first functional module of data source configuration is extracted and generated from an application program corresponding to the application system, a container corresponding to the application system is generated according to the first functional module, and a plurality of data sources corresponding to the application system are configured by executing the container in the process of starting the application system; the first functional module includes configuration code for a plurality of first data sources; the configuration code of each first data source comprises a first loading database driver, a first connecting database program, a first interaction program and a first closing database connection releasing program; the first interactive program is used for indicating the first functional module to execute database sentences by the application system after acquiring the database connection;
if the type of the application system is a type of direct operation, extracting and packaging a second function module configured by the data sources from the application program corresponding to the application system, and configuring a plurality of data sources corresponding to the application system by executing the second function module in the process of starting the application system, wherein the second function module comprises configuration codes of the plurality of second data sources; the configuration code of each second data source comprises a configuration environment information code, a second loading database driver, a second connection database program, a second interaction program and a second closing database connection releasing program; the second interactive program is used for indicating the second functional module to execute the database statement by the application system after the database connection is acquired.
In one embodiment, the computer program when executed by the processor further performs the steps of:
extracting a first data source configuration code from each microservice code;
and performing de-duplication processing on all the extracted first data source configuration codes, and integrating to generate a first functional module.
In one embodiment, the computer program when executed by the processor further performs the steps of:
extracting a second data source configuration code from each micro-service code;
and performing de-duplication processing on all the extracted second data source configuration codes, and packaging to generate a second functional module.
In one embodiment, the computer program when executed by the processor further performs the steps of:
adding an interface configuration code into an application program corresponding to the application system after the first functional module is extracted; the interface configuration code is used for configuring the interaction interface between the container and the database;
and generating a container corresponding to the application system according to the application program added with the codes and the first functional module.
In one embodiment, the computer program when executed by the processor further performs the steps of:
determining the type of the corresponding execution code of the application system; the types of the execution codes comprise war execution code types and jar execution code types;
The type of the war execution code is determined to be the type of the container issue, and the type of the jar execution code is determined to be the type of direct operation.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.

Claims (10)

1. A method of managing a data source, the method comprising:
determining the type of an application system to be configured;
if the type of the application system is the type of the container release, a first functional module of data source configuration is extracted and generated from an application program corresponding to the application system, a container corresponding to the application system is generated according to the first functional module, and a plurality of data sources corresponding to the application system are configured by executing the container in the process of starting the application system;
And if the type of the application system is a direct running type, extracting and packaging a second function module for obtaining data source configuration from an application program corresponding to the application system, and configuring a plurality of data sources corresponding to the application system by executing the second function module in the process of starting the application system.
2. The method for managing data sources according to claim 1, wherein the application program corresponding to the application system includes a plurality of micro service codes, and the first function module for extracting and generating the data source configuration from the application program corresponding to the application system includes:
extracting a first data source configuration code from each of the microservice codes;
and performing de-duplication processing on all the extracted first data source configuration codes, and integrating to generate the first functional module.
3. The method for managing data sources according to claim 1, wherein the application program corresponding to the application system includes a plurality of micro service codes, and the second function module for extracting and encapsulating the data source configuration from the application program corresponding to the application system includes:
extracting a second data source configuration code from each of the microservice codes;
And performing de-duplication processing on all the extracted second data source configuration codes, and packaging to generate the second functional module.
4. A method of managing a data source according to any one of claims 1 to 3, wherein the generating, according to the first functional module, a container corresponding to the application system includes:
adding an interface configuration code into an application program corresponding to the application system after the first functional module is extracted; the interface configuration code is used for configuring an interactive interface between the container and the database;
and generating a container corresponding to the application system according to the application program added with the codes and the first functional module.
5. A method of managing data sources according to any one of claims 1 to 3, characterized in that the first functional module comprises configuration codes of a plurality of first data sources; the configuration code of each first data source comprises a first loading database driver, a first connecting database program, a first interaction program and a first connecting database release connection program; the first interactive program is used for indicating the first functional module to execute the database statement by the application system after the database connection is acquired.
6. A method of managing data sources according to any one of claims 1 to 3, characterized in that the second functional module comprises configuration codes of a plurality of second data sources; the configuration code of each second data source comprises a configuration environment information code, a second loading database driver, a second connection database program, a second interaction program and a second closing database connection releasing program; the second interactive program is used for indicating the second functional module to execute the database statement by the application system after the database connection is acquired.
7. The method for managing data sources according to claim 1, wherein the determining the type of the application system to be configured includes:
determining the type of the corresponding execution code of the application system; the types of the execution codes comprise war execution code types and jar execution code types;
and determining the type of the war executive code as the type issued by the container, and determining the type of the jar executive code as the type directly operated.
8. An information interaction device, the device comprising:
the determining module is used for determining the type of the application system to be configured;
the first configuration module is used for extracting and generating a first function module of data source configuration from an application program corresponding to the application system if the type of the application system is the type of the container release, generating a container corresponding to the application system according to the first function module, and configuring a plurality of data sources corresponding to the application system by executing the container in the process of starting the application system;
And the second configuration module is used for extracting and packaging a second function module for configuring the data sources from the application programs corresponding to the application system if the type of the application system is a direct running type, and configuring a plurality of data sources corresponding to the application system by executing the second function module in the process of starting the application system.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 7 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
CN202310854319.XA 2023-07-12 2023-07-12 Data source management method, device, computer equipment and storage medium Pending CN117112049A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310854319.XA CN117112049A (en) 2023-07-12 2023-07-12 Data source management method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310854319.XA CN117112049A (en) 2023-07-12 2023-07-12 Data source management method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117112049A true CN117112049A (en) 2023-11-24

Family

ID=88799151

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310854319.XA Pending CN117112049A (en) 2023-07-12 2023-07-12 Data source management method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117112049A (en)

Similar Documents

Publication Publication Date Title
CN108958714B (en) Business component type development method and device, computer equipment and storage medium
CN106886406A (en) The generation method and device of exploitation code or document
CN104133772A (en) Automatic test data generation method
CN111061475B (en) Software code generating method, device, computer equipment and storage medium
US20220360628A1 (en) Technologies for conversion of acquirer files for big data ingestion
CN106991100B (en) Data import method and device
US20170054790A1 (en) System and Method for Object Compression and State Synchronization
CN106990960A (en) Code dispositions method and device
CN105160018A (en) Method, device and system for image copy/paste
US8196093B2 (en) Apparatus and method for componentizing legacy system
Baquero et al. Predicting the programming language: Extracting knowledge from stack overflow posts
CN110806891B (en) Method and device for generating software version of embedded device
CN109684207B (en) Method and device for packaging operation sequence, electronic equipment and storage medium
CN117332766A (en) Flow chart generation method, device, computer equipment and storage medium
TWI553561B (en) Method of unifying information and tool from a plurality of information sources and computer program product and matterizer using the same
CN114816772B (en) Debugging method, debugging system and computing device for application running based on compatible layer
CN117112049A (en) Data source management method, device, computer equipment and storage medium
CN116227625A (en) Intelligent model development method, medium and equipment
US10649743B2 (en) Application developing method and system
CN115841095A (en) Document establishing method, system, medium and equipment
CN115729933A (en) Structured bill of material management method, system and storage medium
CN110532526A (en) Data method for transformation, electronic device and computer readable storage medium
US11593325B2 (en) Systems and methods of data migration in multi-layer model-driven applications
US11836483B1 (en) Compatible and secure software upgrades
US20240086160A1 (en) Microservice termination while maintaining high availability

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination