Database environment switching method and device and computer equipment

文档序号:7262 发布日期:2021-09-17 浏览:25次 中文

1. A method for switching database environments, comprising:

establishing a Jenkins project;

acquiring configuration files for various databases;

loading branch information and database option information through a jenkins Parameter plug-in;

and switching the database environment according to the selected branch information and the database option information.

2. The database environment switching method according to claim 1, further comprising:

and starting different application program modules under different database environments.

3. The switching method of database environments according to claim 2, wherein the application program modules include a learning module, a login module, an examination module, a courseware module, and a scoring module.

4. The database environment switching method according to claim 2, wherein the method comprises:

setting configuration files for different databases.

5. The method for switching database environments according to claim 2, wherein the switching database environments according to the selected branch information and the database option information comprises:

and starting and executing a preset script according to the selected branch information and the database option information, calling a corresponding project configuration file, and switching the database environment.

6. A switching apparatus of a database environment, comprising:

the building module is used for building Jenkins projects;

the configuration file acquisition module is used for acquiring configuration files for various databases;

the loading module is used for loading the branch information and the database option information through the jenkins Parameter plug-in;

and the switching module is used for switching the database environment according to the selected branch information and the database option information.

7. The apparatus for switching between database environments of claim 6, wherein the apparatus further comprises:

and the starting module is used for starting different application program modules under different database environments.

8. The switching device of database environment according to claim 7, wherein said application program modules comprise a learning module, a login module, an examination module, a courseware module and a scoring module.

9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the database environment switching method according to any one of claims 1 to 5.

10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the database environment switching method according to any one of claims 1 to 5.

Background

The existing learning platform product can support various databases such as oracle, mysql, dreams, sqlserver and the like. Generally, in order to support multiple databases, multiple database products deploy a set of different systems for different databases. When the test for the multi-database products is oriented, a plurality of sets of environments are deployed for testing, so that the implementation difficulty is high, the resource of an enterprise is wasted, and the implementation cost is increased.

Disclosure of Invention

In view of the above problems, embodiments of the present invention are provided to provide a switching method of a database environment, a switching apparatus of a database environment, a computer device, and a storage medium that overcome or at least partially solve the above problems.

In order to solve the above problem, an embodiment of the present invention discloses a method for switching a database environment, including:

establishing a Jenkins project;

acquiring configuration files for various databases;

loading branch information and database option information through a jenkins Parameter plug-in;

and switching the database environment according to the selected branch information and the database option information.

Preferably, the method further comprises:

and starting different application program modules under different database environments.

Preferably, the application program module comprises a learning module, a login module, an examination module, a courseware module and a grading module.

Preferably, the method comprises:

setting configuration files for different databases.

Preferably, the switching the database environment according to the selected branch information and the database option information includes:

and starting and executing a preset script according to the selected branch information and the database option information, calling a corresponding project configuration file, and switching the database environment.

The embodiment of the invention discloses a switching device of database environment, comprising:

the building module is used for building Jenkins projects;

the configuration file acquisition module is used for acquiring configuration files for various databases;

the loading module is used for loading the branch information and the database option information through the jenkins Parameter plug-in;

and the switching module is used for switching the database environment according to the selected branch information and the database option information.

Preferably, the apparatus further comprises:

and the starting module is used for starting different application program modules under different database environments.

Preferably, the application program module comprises a learning module, a login module, an examination module, a courseware module and a grading module.

The embodiment of the invention discloses computer equipment, which comprises a memory and a processor, wherein the memory stores a computer program, and the processor realizes the steps of the switching method of the database environment when executing the computer program.

The embodiment of the invention discloses a computer readable storage medium, which stores a computer program, and the computer program realizes the steps of the switching method of the database environment when being executed by a processor.

The embodiment of the invention has the following advantages:

in the embodiment of the present invention, the method for switching the database environment includes: establishing a Jenkins project; acquiring configuration files for various databases; loading branch information and database option information through a jenkins Parameter plug-in; and switching the database environment according to the selected branch information and the database option information. And realizing the parameterized starting application by combining a jenkins tool with spring-profile. The tester needs the corresponding environment to start directly, thereby greatly reducing the implementation difficulty, the testing difficulty and the workload and saving resources.

Drawings

In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts;

FIG. 1 is a flow chart illustrating steps of an embodiment of a method for switching database environments according to an embodiment of the present invention;

FIG. 2 is a block diagram of an embodiment of a switching device for a database environment according to an embodiment of the present invention;

FIG. 3 is an internal block diagram of a computer device of an embodiment.

Detailed Description

In order to make the technical problems, technical solutions and advantageous effects solved by the embodiments of the present invention more clearly apparent, the embodiments of the present invention are described in further detail below with reference to the accompanying drawings and the embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

Referring to fig. 1, a flowchart illustrating steps of an embodiment of a database environment switching method according to an embodiment of the present invention is shown, which may specifically include the following steps:

step 101, establishing Jenkins projects;

in the embodiment of the present invention, the method for switching the database environments may be executed on various terminals, such as a Personal Computer (PC), a smart Phone, a tablet Computer, and other terminals capable of installing an application program, for example, a smart watch, and the like.

The method comprises the steps of firstly establishing a Jenkins project, specifically, running Jenkins software on a terminal, and establishing a corresponding Jenkins project on the Jenkins software, wherein the Jenkins software is an extensible automatic execution engine.

102, acquiring configuration files for various databases;

in the embodiment of the present invention, configuration files of multiple databases may be further acquired, and a user may input multiple configuration files, which may be used to activate different environments in combination with-dsspring.

Specifically, the project configuration file loading mechanism through spring can be used for: spring profile, which defines various configuration files through a system and starts different configuration files by using a parameter-Dspring.

Correspondingly, configuration files for different databases may be set first, and specifically, configuration information of a user for the databases may be received to form the configuration files.

103, loading branch information and database option information through a jenkins Parameter plug-in;

in practical application to the embodiment of the invention, the branch information and the database option information can be loaded through a joinns Parameter plug-in, and the joinns Parameter plug-in can be installed on joinns software.

Furthermore, selection information of a user for the branch information and the database option information can be received, software can acquire the branch information and the database option information, and then the branch information and the database option information are loaded through a joinins Parameter plug-in.

And 104, switching the database environment according to the selected branch information and the database option information.

In the embodiment of the invention, when the branch information and the database option information are acquired, the database environment can be switched according to the selected branch information and the database option information so as to test different application program environments.

Further, the method further comprises: and starting different application program modules under different database environments.

After the database environments are switched, different application program modules can be started under the same database environment, and the application program modules are tested, so that the corresponding application program modules can be executed under different database environments.

In the embodiment of the present invention, the application program module includes a learning module, a login module, an examination module, a courseware module, a scoring module, and the like, which are not limited in the embodiment of the present invention.

For example, the test of the learning module can be executed in an oracle database environment, and the test of various modules such as the learning module can be executed in databases such as mysql, dreams, sqlserver and the like. The tester needs the corresponding environment to start directly, thus greatly reducing the implementation difficulty, the test difficulty and the workload.

In the embodiment of the present invention, the switching the database environment according to the selected branch information and the database option information includes: and starting and executing a preset script according to the selected branch information and the database option information, calling a corresponding project configuration file, and switching the database environment.

In the embodiment of the present invention, the method for switching the database environment includes: establishing a Jenkins project; acquiring configuration files for various databases; loading branch information and database option information through a jenkins Parameter plug-in; and switching the database environment according to the selected branch information and the database option information. And realizing the parameterized starting application by combining a jenkins tool with spring-profile. The tester needs the corresponding environment to start directly, thereby greatly reducing the implementation difficulty, the testing difficulty and the workload and saving resources.

It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the illustrated order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments of the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.

Referring to fig. 2, a block diagram of a switching apparatus in a database environment according to an embodiment of the present invention is shown, which may specifically include the following modules:

the building module 301 is used for building Jenkins projects;

a configuration file obtaining module 302, configured to obtain configuration files for multiple databases;

the loading module 303 is used for loading the branch information and the database option information through a jenkins Parameter plug-in;

a switching module 304, configured to switch the database environment according to the selected branch information and the database option information.

Preferably, the apparatus further comprises:

and the starting module is used for starting different application program modules under different database environments.

Preferably, the application program module comprises a learning module, a login module, an examination module, a courseware module and a grading module.

Preferably, the apparatus comprises:

and the setting module is used for setting configuration files aiming at different databases.

Preferably, the switching module includes:

and the switching submodule is used for starting and executing a preset script according to the selected branch information and the database option information, calling a corresponding project configuration file and switching the database environment.

The modules in the switching device of the database environment can be wholly or partially implemented by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.

The switching device of the database environment provided by the above can be used for executing the switching method of the database environment provided by any of the above embodiments, and has corresponding functions and beneficial effects.

In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 3. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile 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 an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method of switching database environments. The display screen of the computer equipment 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, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.

Those skilled in the art will appreciate that the architecture shown in fig. 3 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.

In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:

establishing a Jenkins project;

acquiring configuration files for various databases;

loading branch information and database option information through a jenkins Parameter plug-in;

and switching the database environment according to the selected branch information and the database option information.

Preferably, the method further comprises:

and starting different application program modules under different database environments.

Preferably, the application program module comprises a learning module, a login module, an examination module, a courseware module and a grading module.

Preferably, the method comprises:

setting configuration files for different databases.

Preferably, the switching the database environment according to the selected branch information and the database option information includes:

and starting and executing a preset script according to the selected branch information and the database option information, calling a corresponding project configuration file, and switching the database environment.

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:

establishing a Jenkins project;

acquiring configuration files for various databases;

loading branch information and database option information through a jenkins Parameter plug-in;

and switching the database environment according to the selected branch information and the database option information.

Preferably, the method further comprises:

and starting different application program modules under different database environments.

Preferably, the application program module comprises a learning module, a login module, an examination module, a courseware module and a grading module.

Preferably, the method comprises:

setting configuration files for different databases.

Preferably, the switching the database environment according to the selected branch information and the database option information includes:

and starting and executing a preset script according to the selected branch information and the database option information, calling a corresponding project configuration file, and switching the database environment.

The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.

As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.

Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.

These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.

These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.

While preferred embodiments of the present invention have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the embodiments of the invention.

Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.

The foregoing describes in detail a method for switching a database environment, a device for switching a database environment, a computer device, and a storage medium, and specific examples are applied herein to explain the principles and embodiments of the present invention, and the descriptions of the foregoing examples are only used to help understand the method and the core ideas of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:数据配置方法、装置和计算机设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!