CN116150244A - Database adaptation method, system, terminal equipment and storage medium - Google Patents
Database adaptation method, system, terminal equipment and storage medium Download PDFInfo
- Publication number
- CN116150244A CN116150244A CN202310110021.8A CN202310110021A CN116150244A CN 116150244 A CN116150244 A CN 116150244A CN 202310110021 A CN202310110021 A CN 202310110021A CN 116150244 A CN116150244 A CN 116150244A
- Authority
- CN
- China
- Prior art keywords
- database
- information
- connection
- acquiring
- switching
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/25—Integrating or interfacing systems involving database management systems
- G06F16/252—Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The present disclosure relates to the field of database technologies, and in particular, to a method, a system, a terminal device, and a storage medium for adapting a database. The method comprises the steps of obtaining a current configuration file; reading the current configuration file and generating corresponding driving information; if the driving information analysis is successful, acquiring and connecting the corresponding database type; analyzing the database type and obtaining corresponding connection information; judging whether connection information exists in the history connection record according to the processing requirement of the current data to be processed; if the connection information exists in the history connection record, switching to a corresponding target database according to the connection information; if no connection information exists in the history connection record, acquiring and switching to a corresponding target database according to preset configuration information corresponding to the database type. According to the database adaptation method, system, terminal equipment and storage medium, the switching efficiency of the database can be improved.
Description
Technical Field
The present disclosure relates to the field of database technologies, and in particular, to a method, a system, a terminal device, and a storage medium for adapting a database.
Background
A database is a repository that organizes, stores, and manages data according to a data structure, which is a collection of large amounts of data stored in computer segments for a long period of time, organized, sharable, and uniformly managed.
At present, the application ecology is increasingly perfect under the national production environment based on domestic CPU and operating system, and the database field emerges various types of databases including a Shentong database, a Jin Cang database, a Dameng database and the like. In the nationwide environment, the WEB application system needs to support a plurality of domestic databases such as Shentong, dameng, jin Cang and the like so as to meet the demands of different clients.
In general, in the iterative development process of a daily WEB application system, databases associated with the system need to be frequently modified, keywords are not uniform among different databases, supported data types are not completely consistent, and therefore when different data are processed, the corresponding databases are poor in switching efficiency.
Disclosure of Invention
In order to improve the switching efficiency of databases, the application provides a method, a system, terminal equipment and a storage medium for adapting to the databases.
In a first aspect, the present application provides a method for adapting a database, comprising the steps of:
acquiring a current configuration file;
reading the current configuration file to generate corresponding driving information;
if the driving information is successfully analyzed, acquiring and connecting the corresponding database type;
analyzing the database type to obtain corresponding connection information;
judging whether the connection information exists in the history connection record according to the processing requirement of the current data to be processed;
if the connection information exists in the history connection record, switching to a corresponding target database according to the connection information;
and if the connection information does not exist in the historical connection record, acquiring and switching to the corresponding target database according to the preset configuration information corresponding to the database type.
By adopting the technical scheme, if the analysis of the driving information corresponding to the current configuration file is successful, the connection to the corresponding database is indicated to be successful, meanwhile, the type of the database which is connected at present can be judged through the information corresponding to the current configuration file, the type of the database which is connected at present is further analyzed, the connection information corresponding to various databases can be obtained, then whether the connection information corresponding to the type of the database exists in the history connection record is judged by combining the processing requirement of the data which is to be processed at present, if the connection information exists in the history connection record, the connection information is directly switched to the corresponding target database, if the connection information does not exist in the history connection record, the preset configuration information corresponding to the type of the current database is obtained, then the connection configuration information corresponding to the type of the current database is obtained according to the preset configuration information, and then the connection configuration information is switched to the corresponding target database.
Optionally, if the connection information exists in the history connection record, switching to the corresponding target database according to the connection information includes the following steps:
if the connection information exists in the history connection record, acquiring a corresponding database number according to the connection information;
identifying the database number and acquiring a corresponding history switching instruction;
and switching to the corresponding target database according to the history switching instruction.
By adopting the technical scheme, if the connection information exists in the historical connection record, the corresponding connection record exists, connection information of a corresponding database is not required to be transmitted, a corresponding historical switching instruction is further acquired according to the corresponding database number in the connection record, and the corresponding target database is switched according to the historical switching instruction, so that the switching efficiency of the database is improved.
Optionally, after the switching to the corresponding target database according to the history switching instruction, the method further includes the following steps:
acquiring current time sequence data corresponding to a target database;
judging whether the current time sequence data are aligned or not;
and if the current time sequence data are not aligned, aligning the current time sequence data according to a preset time alignment rule.
By adopting the technical scheme, the current time sequence data is aligned according to the preset time alignment rule, so that the analysis effect of relevant data in a database is enhanced, and the resource allocation of the database is saved.
Optionally, if the current time series data is not aligned, aligning the current time series data according to a preset alignment rule includes the following steps:
if the current time sequence data are not aligned, acquiring the same time point data quantity corresponding to the current time sequence data according to a preset time alignment rule;
setting an alignment priority corresponding to the current time series data according to the same time point data quantity, wherein the same time point data quantity is in direct proportion to the alignment priority;
and aligning the current time sequence data according to the alignment priority.
By adopting the technical scheme, the data with more data quantity at the same time point can be aligned preferentially according to the alignment priority, so that the classification efficiency of the data with the same type in the database is improved, and the database resources are saved.
Optionally, if the connection information does not exist in the historical connection record, acquiring and switching to the corresponding target database according to the preset configuration information corresponding to the database type includes the following steps:
if the connection information does not exist in the historical connection record, acquiring predefined connection information corresponding to the database type according to preset configuration information;
and switching to the corresponding target database according to the predefined connection information.
By adopting the technical scheme, if the connection information does not exist in the historical connection record, the fact that the corresponding connection record does not exist in the current database is indicated, and then the current database can be quickly switched to the corresponding target database according to the corresponding predefined connection information of the current database, so that the switching efficiency of the databases is improved.
Optionally, after the reading the current configuration file and generating the corresponding driving information, the method further includes the following steps:
if the analysis of the driving information fails, recording an error field corresponding to the driving information;
and generating corresponding abnormal identification information according to the error field.
By adopting the technical scheme, if the analysis of the driving information fails, the login information or the basic information of the current database is proved to be wrong, the corresponding abnormal identification information is further generated according to the corresponding error field, and related personnel can be timely reminded of searching and repairing the current configuration file according to the abnormal identification information, so that the repairing efficiency of the abnormality of the current configuration file is improved.
Optionally, after the reading the current configuration file and generating the corresponding driving information, the method further includes the following steps:
if the analysis of the driving information fails, acquiring corresponding basic database information;
and if the basic information of the database does not accord with the preset configuration information, acquiring a corresponding abnormal configuration information item and generating corresponding prompt information.
By adopting the technical scheme, if the basic information of the database does not accord with the preset configuration information, the abnormal error of the basic information of the database is indicated, the corresponding abnormal information item is further acquired, and the corresponding prompt information is generated, so that the specific abnormal information item can be acquired according to the prompt information, and the repair efficiency of the basic configuration information of the database is improved.
In a second aspect, the present application provides an adapted database system comprising:
the first acquisition module is used for acquiring the current configuration file;
the reading module is used for reading the current configuration file and generating corresponding driving information;
the second acquisition module is used for acquiring and connecting the corresponding database type if the driving information is successfully analyzed;
the analysis module is used for analyzing the database type and acquiring corresponding connection information;
the judging module is used for judging whether the connection information exists in the historical connection record according to the processing requirement of the current data to be processed;
the first switching module is used for switching to a corresponding target database according to the connection information if the connection information exists in the historical connection record;
and the second switching module is used for acquiring and switching to the corresponding target database according to the preset configuration information corresponding to the database type if the connection information does not exist in the historical connection record.
By adopting the technical scheme, if the analysis of the driving information corresponding to the current configuration file is successful, the connection to the corresponding database is indicated to be successful, meanwhile, the type of the database which is connected currently can be judged according to the information corresponding to the current configuration file, the type of the database which is connected currently is further analyzed, the connection information corresponding to various databases can be obtained through the analysis module, then, whether the connection information corresponding to the type of the database exists in the historical connection record is judged by combining the processing requirement of the data which is to be processed currently through the judgment module, if the connection information exists in the historical connection record, the connection information is directly switched to the corresponding target database through the first switching module, if the connection information does not exist in the historical connection record, the preset configuration information corresponding to the type of the database is obtained through the second switching module, then, the connection configuration information corresponding to the type of the database is obtained according to the preset configuration information, and the connection configuration information is further switched to the corresponding target database.
In a third aspect, the present application provides a terminal device, which adopts the following technical scheme:
the terminal equipment comprises a memory and a processor, wherein the memory stores computer instructions capable of running on the processor, and the processor adopts the database adapting method when loading and executing the computer instructions.
By adopting the technical scheme, the computer instruction is generated by the method for adapting the database and is stored in the memory to be loaded and executed by the processor, so that the terminal equipment is manufactured according to the memory and the processor, and the terminal equipment is convenient to use.
In a fourth aspect, the present application provides a computer readable storage medium, which adopts the following technical scheme:
a computer readable storage medium having stored therein computer instructions which, when loaded and executed by a processor, employ one of the database adaptation methods described above.
By adopting the technical scheme, the computer instructions are generated by the method for adapting the database and stored in the computer readable storage medium to be loaded and executed by the processor, and the computer instructions are convenient to read and store by the computer readable storage medium.
In summary, the present application includes at least one of the following beneficial technical effects: if the analysis of the driving information corresponding to the current configuration file is successful, the connection to the corresponding database is indicated to be successful, meanwhile, the type of the database which is connected currently can be judged according to the information corresponding to the current configuration file, the type of the database which is connected currently can be further analyzed, the connection information corresponding to various databases can be obtained, then whether the connection information corresponding to the type of the database exists in the historical connection record or not can be judged according to the processing requirement of the data which is to be processed currently, if the connection information exists in the historical connection record, the connection information is directly switched to the corresponding target database, if the connection information does not exist in the historical connection record, the preset configuration information corresponding to the type of the database is obtained, then the connection configuration information corresponding to the type of the database is obtained according to the preset configuration information, and the connection configuration information is switched to the corresponding target database.
Drawings
Fig. 1 is a schematic flow chart of steps S101 to S107 in a database adaptation method of the present application.
Fig. 2 is a schematic flow chart of steps S201 to S203 in a database adaptation method of the present application.
Fig. 3 is a flowchart illustrating steps S301 to S303 in a database adaptation method according to the present application.
Fig. 4 is a schematic flow chart of steps S401 to S403 in a database adaptation method of the present application.
Fig. 5 is a schematic flow chart of steps S501 to S502 in a database adaptation method of the present application.
Fig. 6 is a flowchart illustrating steps S601 to S602 in a database adaptation method according to the present application.
Fig. 7 is a flowchart illustrating steps S701 to S702 in a database adaptation method according to the present application.
Fig. 8 is a block diagram of an adaptation database system of the present application.
Reference numerals illustrate:
1. a first acquisition module; 2. a reading module; 3. a second acquisition module; 4. an analysis module; 5. a judging module; 6. a first switching module; 7. and a second switching module.
Detailed Description
The present application is described in further detail below in conjunction with figures 1-8.
The embodiment of the application discloses a database adaptation method, as shown in fig. 1, comprising the following steps:
s101, acquiring a current configuration file;
s102, reading a current configuration file and generating corresponding driving information;
s103, if the driving information is successfully analyzed, acquiring and connecting the corresponding database type;
s104, analyzing the database type to obtain corresponding connection information;
s105, judging whether connection information exists in the historical connection record according to the processing requirement of the current data to be processed;
s106, if connection information exists in the history connection record, switching to a corresponding target database according to the connection information;
s107, if no connection information exists in the historical connection record, acquiring and switching to a corresponding target database according to preset configuration information corresponding to the database type.
In practical application, the current configuration file in step S101 refers to a configuration information file corresponding to the database when the database is connected, including a service port, database connection information, line pool information, and the like, where the current configuration file may be a jdbc.
Further, the corresponding driving information can be generated by reading the current configuration file, if the driving information is successfully analyzed, the database connection is further established, and meanwhile, the type of the connection database can be judged through the driving information. For example, if the driving information is mysql, the connected database type is mysql database, if the driving information is oracle, the connected database type is oracle database, if the driving information is DM, the connected database type is dream database, if the driving information is oscar, the connected database type is a miracle database. Furthermore, if the analysis of the driving information fails, and the corresponding driving information is a database error or the database type null, the database type is acquired again.
The method comprises the steps of analyzing the obtained database types, obtaining connection information corresponding to the current database types, and judging whether connection information exists in a historical connection record according to the processing requirement of current data to be processed, wherein the processing requirement of the current data to be processed refers to the actual processing requirement of a user on the current data, for example, data are stored in the corresponding database or required data are called from the corresponding database, and the historical connection record refers to record information of the current database types corresponding to historical connection recorded by a system.
If the connection information corresponding to the current database exists in the history connection record, the related connection is established based on the data processing requirement of the user before the current database type is described, and when the current database is switched to the same database, the connection information of the database is not required to be transmitted, and the current database type can be switched to the corresponding target database according to the connection information recorded in the history connection record.
For example, the Db method is used to call the current database connection information in the history connection record and then returns the current model data, and further can be directly switched to the corresponding target database according to the model data and continue to perform other operations corresponding to the target database, so that dynamic switching can be implemented in the query process, where the Db method is a shortcut method for operating Mysql, and a table can be specified for shortcut operation, and the Mysql database needs to be connected before operation.
And if no connection information exists in the historical connection record, the fact that the historical connection record does not exist in the current database type is indicated, and preset configuration information corresponding to the current database type is obtained, wherein the preset configuration information refers to connection information which defines the database type in the item configuration corresponding to the database in advance.
For example, the preset configuration information corresponding to the database configuration 1 is type: mysql, use: root, pwd:1234, host: localhost, port:3306, name: the preset configuration information corresponding to the database configuration 2 is Mysql: /(root): 1234@localhost:3306/thinkhp, and further may directly invoke configuration in Db method for database connection.
According to the database adapting method provided by the embodiment, if the driving information corresponding to the current configuration file is successfully analyzed, the fact that the current connection to the corresponding database is successfully performed is indicated, meanwhile, the type of the database which is currently connected can be judged through the information corresponding to the current configuration file, the type of the database which is currently connected is further analyzed, the connection information corresponding to various databases can be obtained, then whether the connection information corresponding to the type of the database exists in the historical connection record is judged according to the processing requirement of the current data to be processed, if the connection information exists in the historical connection record, the corresponding target database is directly switched according to the connection information, if the connection information does not exist in the historical connection record, the preset configuration information corresponding to the type of the current database is obtained, then the connection configuration information corresponding to the type of the current database is obtained according to the preset configuration information, and the connection configuration information is switched to the corresponding target database.
In one implementation manner of the present embodiment, as shown in fig. 2, step S106, that is, if there is connection information in the history connection record, switching to the corresponding target database according to the connection information includes the following steps:
s201, if connection information exists in the historical connection record, acquiring a corresponding database number according to the connection information;
s202, identifying a database number and acquiring a corresponding history switching instruction;
s203, switching to a corresponding target database according to the history switching instruction.
In practical application, if connection information exists in the history connection record, a preset number of the database can be further obtained according to the connection information, the database number can be in a digital format, and the called database connection is not required to be transmitted into the information of the database connection, wherein the definition mode of the database configuration supports three formats of an array, a character string and calling configuration parameters.
Further, the number corresponding to the database is identified, a history switching instruction corresponding to the database in the history connection record can be obtained, wherein the history switching instruction refers to a history database switching instruction recorded in the history connection record, and then the database is switched to a corresponding target database according to the history switching instruction. For example, the history connection record has connection information of a database corresponding to the processing requirement of the current data to be processed, the corresponding database number is Mysql1 is further obtained according to the connection information, further, a history connection instruction corresponding to the Mysql1 database is obtained by identifying the Mysql1, and the Mysql1 database is switched through the history connection instruction.
According to the database adapting method provided by the embodiment, if the connection information exists in the historical connection record, the corresponding connection record exists, connection information of the corresponding database is not needed to be transmitted, a corresponding historical switching instruction is further obtained according to the corresponding database number in the connection record, and the corresponding target database is switched according to the historical switching instruction, so that the switching efficiency of the database is improved.
In one implementation manner of this embodiment, as shown in fig. 3, after step S203, that is, after switching to the corresponding target database according to the history switching instruction, the method further includes the following steps:
s301, acquiring current time sequence data corresponding to a target database;
s302, judging whether the current time sequence data are aligned;
s303, if the current time sequence data are not aligned, aligning the current time sequence data according to a preset time alignment rule.
In practical application, in order to better analyze data in various databases and integrate corresponding data resources, current time sequence data corresponding to a target database is obtained, wherein the current time sequence data refer to data collected at different times and are used for describing the condition of time variation of the data.
For example, the database stores 2 tables each recording vital signs of a patient at certain times of the day, table 1 recording: 01:30-HR (128), HXPL (19), 05:00-HR (124), HXPL (20), and Table 2 reports: 01:30-CVP (7), SBP (129), DBP (60), 09:30-CVP (6.5), SBP (112) and DBP (63), it can be judged that the current time series data is not aligned.
Further, the current time series data are aligned according to a preset time alignment rule, where the preset time alignment rule is a preset rule that two time lines are combined on one time axis, that is, 01 in table 1 and table 2 according to the preset time alignment rule: alignment of data for 30 time periods: 01:30-HR (128), HXPL (19), CVP (7), SBP (129), and DBP (60), because at 09:30, time table 1 has no relevant data record, and 05:00, time table 2 has no relevant data record, then directly using None to obtain 09:30-None, none, CVP (6.5), SBP (112), DBP (63), 05:00-HR (124), HXPL (20), none, none, none.
According to the database adapting method, the current time sequence data are aligned according to the preset time alignment rule, so that analysis effects of relevant data in the database are enhanced, and database resource allocation is saved.
In one implementation manner of the present embodiment, as shown in fig. 4, step S303, that is, if the current time series data is not aligned, includes the following steps of:
s401, if the current time sequence data are not aligned, acquiring the same time point data quantity corresponding to the current time sequence data according to a preset time alignment rule;
s402, setting alignment priority corresponding to current time sequence data according to the same time point data quantity, wherein the same time point data quantity is in direct proportion to the alignment priority;
s403, aligning the current time sequence data according to the alignment priority.
In practical application, in order to improve alignment efficiency of time series data, the same time point data amount corresponding to the current time series data is further obtained, the same time point data amount refers to the data amount corresponding to the same time axis, and the alignment priority corresponding to the current time series data is set according to the same time point data amount, wherein the same time point data amount is in direct proportion to the alignment priority, that is, the more the same time point data amount is, the higher the corresponding alignment priority is.
For example, tables 1 and 2 mentioned above, 05:00 and 09:30 time axes need to be aligned, and further judging that the data amount of the same time point corresponding to 05:00 is 2, and 09:30 is 3, then 09: the alignment priority of the current time series data corresponding to the 30 time axis is higher than that of the current time series data corresponding to the 05:00 time axis, and then the priority pair 09: and 30, aligning the current time series data corresponding to the time axis.
According to the database adapting method, the data with more data quantity at the same time point can be aligned preferentially according to the alignment priority, so that the classification efficiency of the data with the same type in the database is improved, and the database resources are saved.
In one implementation manner of the present embodiment, as shown in fig. 5, step S107, that is, if no connection information exists in the history connection record, of acquiring and switching to the corresponding target database according to the preset configuration information corresponding to the database type includes the following steps:
s501, if no connection information exists in the historical connection record, acquiring predefined connection information corresponding to the database type according to preset configuration information;
s502, switching to a corresponding target database according to the predefined connection information.
In practical application, in order to improve the switching efficiency of the database, if no corresponding connection information exists in the historical connection record, predefined connection information corresponding to the type of the database is obtained according to preset configuration information, wherein the predefined connection information refers to connection information defined for the database in advance.
For example, the predefined connection information of the database is set by invoking the db method of the Model class, including the database number and the database configuration, the database number being in a digital format, for the default database connection, the internal database number is 0, so that the database configuration with the database number 0 is no longer defined in order to avoid collisions.
Furthermore, a database connection with the number of 1 is added through the db method, when the database 1 needs to be switched, the corresponding database configuration of the database 1 is called to complete the switching, and when the database connection needs to be switched to the default database connection, the switching can be completed only by calling the corresponding database configuration of the database 0.
According to the database adapting method, if no connection information exists in the historical connection records, the fact that the current database does not have the corresponding connection records is indicated, and then the current database can be quickly switched to the corresponding target database according to the corresponding predefined connection information of the current database, so that the switching efficiency of the databases is improved.
In one implementation manner of this embodiment, as shown in fig. 6, in step S102, the current configuration file is read, and the following steps are further included after the corresponding driving information is generated:
s601, if the analysis of the driving information fails, recording an error field corresponding to the driving information;
s602, corresponding abnormal identification information is generated according to the error field.
In practical application, in order to rapidly check the corresponding driving information of the configuration file, when the analysis of the driving information fails, an error field corresponding to the driving information is recorded, and corresponding abnormal identification information is further generated according to the information displayed by the error field.
For example, when the driving information corresponding to the current configuration file is read as "database error", the driving information analysis failure is indicated, the "database error" is an error field corresponding to the driving information, and the system further acquires the abnormal identification information of the database type or corresponding warning generation according to the "database error".
According to the method for adapting the database, if the analysis of the driving information fails, the login information or the basic information of the current database is described as being in error, the corresponding abnormal identification information is further generated according to the corresponding error field, and related personnel can be timely reminded of searching and repairing the current configuration file according to the abnormal identification information, so that the repairing efficiency of the abnormality of the current configuration file is improved.
In one implementation manner of this embodiment, as shown in fig. 7, in step S102, the current configuration file is read, and the following steps are further included after the corresponding driving information is generated:
s701, if the analysis of the driving information fails, acquiring corresponding basic information of a database;
s702, if the basic information of the database does not accord with the preset configuration information, acquiring a corresponding abnormal configuration information item, and generating corresponding prompt information.
In practical application, in order to further acquire the reason of failure in analysis of the driving information, the system acquires corresponding basic information of the database according to the error field, and further, if the basic information of the database does not accord with the corresponding preset configuration information, the basic information of the database is not in accord with the preset configuration information of the database, and the preset configuration information refers to the preset configuration information of the database.
Further, a corresponding abnormal configuration information item is obtained, corresponding prompt information is generated, for example, the abnormal configuration information item is an IP address of a database, and corresponding prompt information is generated according to the IP address.
According to the database adapting method, if the basic information of the database does not accord with the preset configuration information, the abnormal error of the basic information of the database is indicated, the corresponding abnormal information item is further obtained, the corresponding prompt information is generated, and therefore the specific abnormal information item can be obtained according to the prompt information, and accordingly the repairing efficiency of the basic configuration information of the database is improved.
The embodiment of the application discloses an adaptive database system, as shown in fig. 8, including:
the first acquisition module 1 is used for acquiring a current configuration file;
the reading module 2 is used for reading the current configuration file and generating corresponding driving information;
the second acquisition module 3 is used for acquiring and connecting the corresponding database type if the driving information analysis is successful;
the analysis module 4 is used for analyzing the database types and acquiring corresponding connection information;
the judging module 5 is used for judging whether the connection information exists in the historical connection record according to the processing requirement of the current data to be processed;
the first switching module 6 is used for switching to a corresponding target database according to the connection information if the connection information exists in the historical connection record;
and the second switching module 7 is used for acquiring and switching to the corresponding target database according to the preset configuration information corresponding to the database type if the connection information does not exist in the historical connection record.
In the adaptive database system provided in this embodiment, if the analysis of the driving information corresponding to the current configuration file is successful, it is indicated that the connection to the corresponding database is successful, meanwhile, the type of the database which is currently connected may be determined by the information corresponding to the current configuration file, the type of the database which is currently connected may be further analyzed, the connection information corresponding to various databases may be obtained by the analysis module 4, then, by the determination module 5, whether the connection information corresponding to the type of the database exists in the history connection record in combination with the processing requirement of the current data to be processed, if the connection information exists in the history connection record, the connection information is directly switched to the corresponding target database by the first switching module 6, if the connection information does not exist in the history connection record, the preset configuration information corresponding to the type of the current database is obtained by the second switching module 7, then the connection configuration information corresponding to the type of the current database is obtained according to the preset configuration information, and then, by switching the connection configuration information to the corresponding target database, since the type of the current connection database may be identified by reading the configuration file, the processing requirement of the current data to be further combined and the connection information of the current connection database may be quickly switched to the corresponding target database, thereby improving the switching efficiency of the database.
It should be noted that, the adaptive database system provided in the embodiment of the present application further includes each module and/or the corresponding sub-module corresponding to the logic function or the logic step of any one of the foregoing adaptive database methods, so that the same effects as those of each logic function or logic step are achieved, and specifically will not be described herein.
The embodiment of the application also discloses a terminal device, which comprises a memory, a processor and computer instructions stored in the memory and capable of running on the processor, wherein when the processor executes the computer instructions, any one of the database adaptation methods in the embodiment is adopted.
The terminal device may be a computer device such as a desktop computer, a notebook computer, or a cloud server, and the terminal device includes, but is not limited to, a processor and a memory, for example, the terminal device may further include an input/output device, a network access device, a bus, and the like.
The processor may be a Central Processing Unit (CPU), or of course, according to actual use, other general purpose processors, digital Signal Processors (DSP), application Specific Integrated Circuits (ASIC), ready-made programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., and the general purpose processor may be a microprocessor or any conventional processor, etc., which is not limited in this application.
The memory may be an internal storage unit of the terminal device, for example, a hard disk or a memory of the terminal device, or may be an external storage device of the terminal device, for example, a plug-in hard disk, a Smart Memory Card (SMC), a secure digital card (SD), or a flash memory card (FC) provided on the terminal device, or the like, and may be a combination of the internal storage unit of the terminal device and the external storage device, where the memory is used to store computer instructions and other instructions and data required by the terminal device, and the memory may be used to temporarily store data that has been output or is to be output, which is not limited in this application.
Any of the adaptation database methods in the embodiments is stored in the memory of the terminal device through the terminal device, and is loaded and executed on the processor of the terminal device, so that the terminal device is convenient to use.
The embodiment of the application also discloses a computer readable storage medium, and the computer readable storage medium stores computer instructions, wherein when the computer instructions are executed by a processor, any one of the database adaptation methods in the above embodiments is adopted.
The computer instructions may be stored in a computer readable medium, where the computer instructions include computer instruction codes, where the computer instruction codes may be in a source code form, an object code form, an executable file form, or some middleware form, etc., and the computer readable medium includes any entity or device capable of carrying the computer instruction codes, a recording medium, a usb disk, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a Random Access Memory (RAM), an electrical carrier signal, a telecommunication signal, a software distribution medium, etc., where the computer readable medium includes but is not limited to the above components.
Wherein, any of the above-described methods of adapting a database are stored in a computer-readable storage medium by the present computer-readable storage medium, and are loaded and executed on a processor to facilitate the storage and application of the above-described methods.
The foregoing are all preferred embodiments of the present application, and are not intended to limit the scope of the present application in any way, therefore: all equivalent changes in structure, shape and principle of this application should be covered in the protection scope of this application.
Claims (10)
1. A method of adapting a database, comprising the steps of:
acquiring a current configuration file;
reading the current configuration file to generate corresponding driving information;
if the driving information is successfully analyzed, acquiring and connecting the corresponding database type;
analyzing the database type to obtain corresponding connection information;
judging whether the connection information exists in the history connection record according to the processing requirement of the current data to be processed;
if the connection information exists in the history connection record, switching to a corresponding target database according to the connection information;
and if the connection information does not exist in the historical connection record, acquiring and switching to the corresponding target database according to the preset configuration information corresponding to the database type.
2. The method for adapting a database according to claim 1, wherein if the connection information exists in the history connection record, switching to the corresponding target database according to the connection information comprises the following steps:
if the connection information exists in the history connection record, acquiring a corresponding database number according to the connection information;
identifying the database number and acquiring a corresponding history switching instruction;
and switching to the corresponding target database according to the history switching instruction.
3. A method of adapting a database according to claim 2, further comprising the steps, after said switching to the corresponding target database according to said history switching instruction, of:
acquiring current time sequence data corresponding to a target database;
judging whether the current time sequence data are aligned or not;
and if the current time sequence data are not aligned, aligning the current time sequence data according to a preset time alignment rule.
4. A method of adapting a database according to claim 3, wherein said aligning said current time series data according to a preset alignment rule if said current time series data is not aligned comprises the steps of:
if the current time sequence data are not aligned, acquiring the same time point data quantity corresponding to the current time sequence data according to a preset time alignment rule;
setting an alignment priority corresponding to the current time series data according to the same time point data quantity, wherein the same time point data quantity is in direct proportion to the alignment priority;
and aligning the current time sequence data according to the alignment priority.
5. The method for adapting a database according to claim 1, wherein if the connection information does not exist in the historical connection record, acquiring and switching to the corresponding target database according to the preset configuration information corresponding to the database type includes the following steps:
if the connection information does not exist in the historical connection record, acquiring predefined connection information corresponding to the database type according to preset configuration information;
and switching to the corresponding target database according to the predefined connection information.
6. The method of adapting a database according to claim 1, further comprising the steps of, after said reading said current profile, generating corresponding driving information:
if the analysis of the driving information fails, recording an error field corresponding to the driving information;
and generating corresponding abnormal identification information according to the error field.
7. The method of adapting a database according to claim 1, further comprising the steps of, after said reading said current profile, generating corresponding driving information:
if the analysis of the driving information fails, acquiring corresponding basic database information;
and if the basic information of the database does not accord with the preset configuration information, acquiring a corresponding abnormal configuration information item and generating corresponding prompt information.
8. An adaptation database system, comprising:
the first acquisition module (1) is used for acquiring the current configuration file;
the reading module (2) is used for reading the current configuration file and generating corresponding driving information;
the second acquisition module (3) is used for acquiring and connecting the corresponding database type if the driving information is successfully analyzed;
the analysis module (4) is used for analyzing the database types and acquiring corresponding connection information;
the judging module (5) is used for judging whether the connection information exists in the historical connection record according to the processing requirement of the current data to be processed;
the first switching module (6) is used for switching to a corresponding target database according to the connection information if the connection information exists in the historical connection record;
and the second switching module (7) is used for acquiring and switching to the corresponding target database according to the preset configuration information corresponding to the database type if the connection information does not exist in the historical connection record.
9. A terminal device comprising a memory and a processor, characterized in that the memory has stored therein computer instructions executable on the processor, which processor, when loaded and executed, employs a method of adapting a database according to any of claims 1 to 7.
10. A computer readable storage medium having stored therein computer instructions, which when loaded and executed by a processor, employ a method of adapting a database according to any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310110021.8A CN116150244A (en) | 2023-02-02 | 2023-02-02 | Database adaptation method, system, terminal equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310110021.8A CN116150244A (en) | 2023-02-02 | 2023-02-02 | Database adaptation method, system, terminal equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116150244A true CN116150244A (en) | 2023-05-23 |
Family
ID=86373139
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310110021.8A Pending CN116150244A (en) | 2023-02-02 | 2023-02-02 | Database adaptation method, system, terminal equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116150244A (en) |
-
2023
- 2023-02-02 CN CN202310110021.8A patent/CN116150244A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108427705B (en) | Electronic device, distributed system log query method and storage medium | |
CN110781231B (en) | Database-based batch import method, device, equipment and storage medium | |
US10824372B2 (en) | Data recovery method and device, and cloud storage system | |
CN102571403B (en) | The implementation method of general data quality control adapter and device | |
CN113360519B (en) | Data processing method, device, equipment and storage medium | |
CN110737689B (en) | Data standard compliance detection method, device, system and storage medium | |
CN112988770B (en) | Method, device, electronic equipment and storage medium for updating serial number | |
CN110688096B (en) | Method and device for constructing application program containing plug-in, medium and electronic equipment | |
JP2024509629A (en) | Quantum car type component basic database creation method, device, electronic equipment, and storage medium | |
CN112328631A (en) | Production fault analysis method and device, electronic equipment and storage medium | |
WO2019104891A1 (en) | Method and device for importing and exporting report, storage medium, and terminal | |
CN113204558B (en) | Automatic data table structure updating method and device | |
CN113704790A (en) | Abnormal log information summarizing method and computer equipment | |
CN111858730A (en) | Data importing and exporting device, method, equipment and medium of graph database | |
CN107066522B (en) | Database access method and device | |
CN113051102A (en) | File backup method, device, system, storage medium and computer equipment | |
CN117992357A (en) | Query statement detection method, device, equipment and medium for distributed database | |
CN115620877A (en) | Method, system, equipment and storage medium for uploading medical data to cloud platform | |
CN111339560B (en) | Data isolation method, device and system | |
CN116069725A (en) | File migration method, device, apparatus, medium and program product | |
CN110674119A (en) | Data processing method, system and computer readable storage medium | |
CN116150244A (en) | Database adaptation method, system, terminal equipment and storage medium | |
CN116303427A (en) | Data processing method and device, electronic equipment and storage medium | |
CN112148705A (en) | Data migration method and device | |
CN110471708B (en) | Method and device for acquiring configuration items based on reusable components |
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 |