An adaptation database method, system, terminal device and storage medium

By parsing configuration files and historical connection records, and combining the data requirements to be processed, domestic databases can be quickly identified and switched, solving the problem of low switching efficiency between different domestic databases and improving database switching efficiency and data analysis results.

CN116150244BActive Publication Date: 2026-07-14BEIJING RONGANTE INTELLIGENT TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING RONGANTE INTELLIGENT TECH CO LTD
Filing Date
2023-02-02
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

In a fully domestically produced environment, the switching efficiency between different domestic databases is poor, resulting in low efficiency when frequently modifying the databases associated with the system during the iterative development of web application systems.

Method used

By obtaining the current configuration file, parsing the driver information and connecting to the database type, and determining whether there is connection information in the historical connection records, if there is, the connection is switched directly; otherwise, the preset configuration information is obtained and the target database is switched. The system can quickly identify and switch based on the needs of the data to be processed.

Benefits of technology

It improved database switching efficiency, saved resource allocation, and enhanced data analysis and repair efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116150244B_ABST
    Figure CN116150244B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of databases, in particular to an adaptive database method and system, a terminal device and a storage medium. The method comprises the following steps: obtaining a current configuration file; reading the current configuration file to generate corresponding driving information; if the driving information is successfully parsed, obtaining and connecting a corresponding database type; parsing the database type to obtain corresponding connection information; judging whether the connection information exists in historical connection records according to the processing requirement of current data to be processed; if the connection information exists in the historical connection records, switching to a corresponding target database according to the connection information; and if the connection information does not exist in the historical connection records, obtaining preset configuration information corresponding to the database type and switching to the corresponding target database. The adaptive database method, system, terminal device and storage medium provided by the application can improve the switching efficiency of the database.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of database technology, and in particular to a database adaptation method, system, terminal device, and storage medium. Background Technology

[0002] A database is a repository for organizing, storing, and managing data according to a data structure. It is a large collection of organized, shareable, and uniformly managed data that is stored long-term in a computer segment.

[0003] Currently, the application ecosystem based on domestically produced CPUs and operating systems in a fully domestically-owned environment is becoming increasingly mature, and various types of databases have emerged in the database field, including ShenTong Database, Kingbase Database, and DM Database. Web application systems in a fully domestically-owned environment need to support multiple domestic databases such as ShenTong, DM, and Kingbase to meet the needs of different customers.

[0004] In general, during the iterative development of daily web application systems, it is necessary to frequently modify the databases associated with the system. Different databases have inconsistent keywords and do not fully support the same data types, resulting in poor efficiency when switching between databases to process different data. Summary of the Invention

[0005] To improve database switching efficiency, this application provides a database adaptation method, system, terminal device, and storage medium.

[0006] Firstly, this application provides a database adaptation method, comprising the following steps:

[0007] Get the current configuration file;

[0008] Read the current configuration file and generate the corresponding driver information;

[0009] If the driver information is successfully parsed, the corresponding database type is obtained and connected.

[0010] Parse the database type to obtain the corresponding connection information;

[0011] Based on the processing requirements of the current data to be processed, determine whether the connection information exists in the historical connection records;

[0012] If the connection information exists in the historical connection records, then switch to the corresponding target database based on the connection information;

[0013] If the connection information is not found in the historical connection records, then the system obtains and switches to the corresponding target database according to the preset configuration information corresponding to the database type.

[0014] By adopting the above technical solution, if the driver information corresponding to the current configuration file is successfully parsed, it indicates that a successful connection to the corresponding database has been established. Simultaneously, the type of the currently connected database can be determined through the information in the current configuration file. Further parsing of the current database type allows for the acquisition of connection information for various database types. Then, based on the processing requirements of the current data to be processed, it is determined whether connection information corresponding to the aforementioned database type exists in the historical connection records. If the connection information exists in the historical connection records, the system directly switches to the corresponding target database based on the connection information. If the connection information does not exist in the historical connection records, the system obtains the preset configuration information corresponding to the current database type, and then obtains the connection configuration information corresponding to the current database type. Finally, the system switches to the corresponding target database based on this connection configuration information. Since the type of the currently connected database can be identified by reading the configuration file, the system can quickly switch to the corresponding target database based on the processing requirements of the current data to be processed and the connection information of the currently connected database, thereby improving the database switching efficiency.

[0015] Optionally, if the connection information exists in the historical connection records, switching to the corresponding target database based on the connection information includes the following steps:

[0016] If the connection information exists in the historical connection records, the corresponding database number is obtained based on the connection information;

[0017] Identify the database number and obtain the corresponding historical switching instruction;

[0018] Switch to the corresponding target database according to the historical switching instruction.

[0019] By adopting the above technical solution, if the connection information exists in the historical connection record, it means that the corresponding connection record already exists, so there is no need to pass in the connection information of the corresponding database. Furthermore, the corresponding historical switching instruction is obtained according to the database number in the connection record, and the database is switched to the corresponding target database according to the historical switching instruction, thereby improving the database switching efficiency.

[0020] Optionally, after switching to the corresponding target database according to the historical switching instruction, the following steps are further included:

[0021] Retrieve the current time series data corresponding to the target database;

[0022] Determine whether the current time series data is aligned;

[0023] If the current time series data is not aligned, then the current time series data will be aligned according to the preset time alignment rules.

[0024] By adopting the above technical solution, the current time series data is aligned according to the preset time alignment rules, thereby enhancing the analysis effect of related data in the database and saving database resource allocation.

[0025] 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:

[0026] If the current time series data is not aligned, the amount of data at the same time point corresponding to the current time series data is obtained according to the preset time alignment rules;

[0027] Based on the amount of data at the same time point, an alignment priority is set for the current time series data, and the amount of data at the same time point is proportional to the alignment priority.

[0028] The current time series data is aligned according to the alignment priority.

[0029] By adopting the above technical solution, data with a large amount of data at the same time point can be aligned first according to the alignment priority, thereby improving the classification efficiency of data of the same type in the database and saving database resources.

[0030] Optionally, if the connection information is not found in the historical connection records, then obtaining and switching to the corresponding target database according to the preset configuration information corresponding to the database type includes the following steps:

[0031] If the connection information is not found in the historical connection records, then the predefined connection information corresponding to the database type is obtained according to the preset configuration information;

[0032] Switch to the corresponding target database based on the predefined connection information.

[0033] By adopting the above technical solution, if the connection information is not found in the historical connection records, it means that the current database does not have the corresponding connection record. Then, the database can be quickly switched to the corresponding target database according to the corresponding predefined connection information of the current database, thereby improving the database switching efficiency.

[0034] Optionally, after reading the current configuration file and generating the corresponding driver information, the following steps are also included:

[0035] If the driver information parsing fails, the error field corresponding to the driver information is recorded;

[0036] Based on the error field, generate corresponding exception identification information.

[0037] By adopting the above technical solution, if the driver information parsing fails, it indicates that the login information or basic information of the current database is incorrect. Furthermore, corresponding error identification information is generated based on the corresponding error fields. Based on this error identification information, relevant personnel can be promptly reminded to search and repair the current configuration file, thereby improving the repair efficiency of the current configuration file when anomalies occur.

[0038] Optionally, after reading the current configuration file and generating the corresponding driver information, the following steps are also included:

[0039] If the driver information parsing fails, then obtain the corresponding basic database information;

[0040] If the basic information of the database does not conform to the preset configuration information, the corresponding abnormal configuration information item is obtained and the corresponding prompt information is generated.

[0041] By adopting the above technical solution, if the basic information of the database does not conform to the preset configuration information, it indicates that there is an abnormal error in the basic information of the database. The corresponding abnormal information items are then obtained and corresponding prompt information is generated. Based on the prompt information, the specific abnormal information items can be obtained, thereby improving the repair efficiency of the basic configuration information of the database.

[0042] Secondly, this application provides an adapted database system, including:

[0043] The first acquisition module is used to acquire the current configuration file;

[0044] The reading module is used to read the current configuration file and generate corresponding driver information;

[0045] If the driver information is successfully parsed, the second acquisition module is used to acquire and connect to the corresponding database type.

[0046] The parsing module is used to parse the database type and obtain the corresponding connection information;

[0047] The judgment module is used to determine whether the connection information exists in the historical connection records based on the processing requirements of the current data to be processed;

[0048] If the connection information exists in the historical connection record, the first switching module is used to switch to the corresponding target database according to the connection information.

[0049] If the connection information is not found in the historical connection records, the second switching module is used to obtain and switch to the corresponding target database according to the preset configuration information corresponding to the database type.

[0050] By adopting the above technical solution, if the driver information corresponding to the current configuration file is successfully parsed, it indicates that a successful connection to the corresponding database has been established. Simultaneously, the database type of the current connection can be determined through the information in the current configuration file. Further parsing of the current database type allows the parsing module to obtain connection information for various database types. Then, the judgment module, combined with the processing requirements of the current data to be processed, determines whether connection information corresponding to the aforementioned database type exists in the historical connection records. If the connection information exists in the historical connection records, the first switching module directly switches to the corresponding target database based on the connection information. If the connection information does not exist in the historical connection records, the second switching module obtains the preset configuration information corresponding to the current database type, and then obtains the connection configuration information corresponding to the current database type based on the preset configuration information. Finally, the connection configuration information is used to switch to the corresponding target database. Since the type of the currently connected database can be identified by reading the configuration file, the processing requirements of the current data to be processed and the connection information of the currently connected database can be combined to quickly switch to the corresponding target database, thereby improving the database switching efficiency.

[0051] Thirdly, this application provides a terminal device, which adopts the following technical solution:

[0052] A terminal device includes a memory and a processor. The memory stores computer instructions that can be executed on the processor. When the processor loads and executes the computer instructions, it employs one of the aforementioned adaptive database methods.

[0053] By adopting the above technical solution, computer instructions are generated by the above-mentioned database adaptation method and stored in the memory for loading and execution by the processor. Thus, terminal devices are made according to the memory and processor, which is convenient to use.

[0054] Fourthly, this application provides a computer-readable storage medium, which adopts the following technical solution:

[0055] A computer-readable storage medium storing computer instructions, wherein the computer instructions, when loaded and executed by a processor, employ the aforementioned adapted database method.

[0056] By adopting the above technical solution, computer instructions are generated by the above-mentioned database adaptation method and stored in a computer-readable storage medium for loading and execution by the processor. The computer-readable storage medium facilitates the reading and storage of computer instructions.

[0057] In summary, this application includes at least one of the following beneficial technical effects: If the driver information corresponding to the current configuration file is successfully parsed, it indicates that a successful connection to the corresponding database has been established. Simultaneously, the type of the currently connected database can be determined through the information in the current configuration file. Further parsing of the current database type allows for the acquisition of connection information for various database types. Then, based on the processing requirements of the current data to be processed, it is determined whether connection information corresponding to the aforementioned database type exists in the historical connection records. If the connection information exists in the historical connection records, the system directly switches to the corresponding target database based on the connection information. If the connection information does not exist in the historical connection records, the system obtains the preset configuration information corresponding to the current database type, and then obtains the connection configuration information corresponding to the current database type based on the preset configuration information. Finally, the system switches to the corresponding target database based on this connection configuration information. Since the type of the currently connected database can be identified by reading the configuration file, the system can quickly switch to the corresponding target database based on the processing requirements of the current data to be processed and the connection information of the currently connected database, thereby improving the database switching efficiency. Attached Figure Description

[0058] Figure 1 This is a flowchart illustrating steps S101 to S107 of a database adaptation method according to this application.

[0059] Figure 2 This is a flowchart illustrating steps S201 to S203 of a database adaptation method according to this application.

[0060] Figure 3 This is a flowchart illustrating steps S301 to S303 of a database adaptation method according to this application.

[0061] Figure 4 This is a flowchart illustrating steps S401 to S403 of a database adaptation method according to this application.

[0062] Figure 5 This is a flowchart illustrating steps S501 to S502 in a database adaptation method according to this application.

[0063] Figure 6 This is a flowchart illustrating steps S601 to S602 in a database adaptation method according to this application.

[0064] Figure 7 This is a flowchart illustrating steps S701 to S702 in a database adaptation method according to this application.

[0065] Figure 8 This is a schematic diagram of a module adapted to a database system according to this application.

[0066] Explanation of reference numerals in the attached figures:

[0067] 1. First acquisition module; 2. Reading module; 3. Second acquisition module; 4. Parsing module; 5. Judgment module; 6. First switching module; 7. Second switching module. Detailed Implementation

[0068] The following is in conjunction with the appendix Figure 1-8 This application will be described in further detail.

[0069] This application discloses a method for adapting to a database, such as... Figure 1 As shown, it includes the following steps:

[0070] S101. Get the current configuration file;

[0071] S102. Read the current configuration file and generate the corresponding driver information;

[0072] S103. If the driver information is successfully parsed, obtain and connect to the corresponding database type;

[0073] S104. Parse the database type and obtain the corresponding connection information;

[0074] S105. Based on the processing requirements of the current data to be processed, determine whether there is connection information in the historical connection records;

[0075] S106. If connection information exists in the historical connection records, switch to the corresponding target database according to the connection information;

[0076] S107. If there is no connection information in the historical connection records, obtain and switch to the corresponding target database according to the preset configuration information corresponding to the database type.

[0077] In practical applications, the current configuration file in step S101 refers to the configuration information file corresponding to the database when connecting to the database, including service port, database connection information, line pool information, etc. The current configuration file can be the jdbc.properties configuration file, which contains the database username, password, IP address and other related information, i.e., the basic information for logging into the database.

[0078] Furthermore, reading the current configuration file generates corresponding driver information. If the driver information is successfully parsed, a database connection is established. This driver information also indicates the type of database being connected to. For example, if the driver information is "mysql", the connected database type is MySQL; if the driver information is "oracle", the connected database type is Oracle; if the driver information is "DM", the connected database type is DM (DaMeng Database); and if the driver information is "oscar", the connected database type is SMART (ShenTong Database). Moreover, if driver information parsing fails, resulting in a database error or a null database type, the database type is retrieved again.

[0079] Parsing the database type obtained above can yield the connection information corresponding to the current database type. Further, based on the processing requirements of the current data to be processed, it can be determined whether there is connection information in the historical connection records. The processing requirements of the current data to be processed refer to the user's actual processing requirements for the current data, such as storing the data in the corresponding database or calling the required data from the corresponding database. The historical connection records refer to the record information of the historical connections corresponding to the current database type recorded by the system.

[0080] It should be noted that if the historical connection record contains connection information for the current database, it means that a connection to this current database type was previously established based on the user's data processing needs. When switching to the same database this time, it is not necessary to pass in the connection information of that database. The connection information can be used to switch to the corresponding target database based on the connection information recorded in the historical connection record.

[0081] For example, the Db method can be used to retrieve the current database connection information from the historical connection record and return the current model data. Based on this model data, you can directly switch to the corresponding target database and continue to perform other operations on the target database. Therefore, dynamic switching can be achieved during the query process. The Db method is a shortcut method for operating MySQL. It can specify a table for quick operation. Before the operation, you need to connect to the MySQL database.

[0082] Furthermore, if there is no connection information in the historical connection records, it means that there is no historical connection record for the current database type. In this case, the corresponding preset configuration information for the current database type is obtained. The preset configuration information refers to the connection information for the database type that has been defined in the project configuration corresponding to the database.

[0083] For example, the default configuration information for database configuration 1 is: type:Mysql, use:root, pwd:1234, host:localhost, port:3306, name:thinkhp. The default configuration information for database configuration 2 is: Mysql: / / root:1234@localhost:3306 / thinkhp. Therefore, the configuration can be directly called in the Db method to connect to the database.

[0084] The database adaptation method provided in this embodiment indicates that a successful connection to the corresponding database has been achieved if the driver information corresponding to the current configuration file is successfully parsed. Simultaneously, the database type of the current connection can be determined through the information in the current configuration file. Further parsing of the current database type yields connection information for various database types. Then, based on the processing requirements of the current data to be processed, it is determined whether connection information corresponding to the aforementioned database type exists in the historical connection records. If connection information exists in the historical connection records, the system directly switches to the corresponding target database based on the connection information. If no connection information exists in the historical connection records, the system obtains the preset configuration information corresponding to the current database type, and then obtains the connection configuration information corresponding to the current database type. Finally, the system switches to the corresponding target database based on this connection configuration information. Since the type of the currently connected database can be identified by reading the configuration file, the system can quickly switch to the corresponding target database based on the processing requirements of the current data to be processed and the connection information of the currently connected database, thereby improving the database switching efficiency.

[0085] In one embodiment of this example, such as Figure 2 As shown, step S106, which involves switching to the corresponding target database based on the connection information if connection information exists in the historical connection records, includes the following steps:

[0086] S201. If connection information exists in the historical connection records, obtain the corresponding database number based on the connection information;

[0087] S202. Identify the database number and obtain the corresponding historical switching instruction;

[0088] S203. Switch to the corresponding target database according to the historical switching instructions.

[0089] In practical applications, if connection information exists in the historical connection records, the database's pre-set number can be obtained based on that connection information. The database number can be in numeric format. For database connections that have already been called, it is not necessary to pass in the database connection information again. The database configuration can be defined in three formats: array, string, and calling configuration parameters.

[0090] Furthermore, by identifying the database's corresponding ID, the historical switch instruction for that database can be obtained from the historical connection records. The historical switch instruction refers to the historical database switch instructions recorded in the historical connection records. Then, the user can switch to the corresponding target database based on this historical switch instruction. For example, if the historical connection records contain connection information for the database corresponding to the processing requirement of the currently pending data, the corresponding database ID, Mysql1, can be obtained based on this connection information. Then, by identifying Mysql1, the historical connection instruction for the Mysql1 database can be obtained, and the user can switch to the Mysql1 database using this historical connection instruction.

[0091] The database adaptation method provided in this embodiment can improve database switching efficiency if connection information already exists in the historical connection record.

[0092] In one embodiment of this example, such as Figure 3 As shown, after step S203, which is to switch to the corresponding target database according to the historical switching instruction, the following steps are also included:

[0093] S301. Obtain the current time series data corresponding to the target database;

[0094] S302. Determine if the current time series data is aligned;

[0095] S303. If the current time series data is not aligned, then align the current time series data according to the preset time alignment rules.

[0096] In practical applications, in order to better analyze data from various types of databases and perform corresponding data resource integration, the current time series data corresponding to the target database is obtained. The current time series data refers to the data collected at different times, which is used to describe the changes of data over time.

[0097] For example, the database stores two tables that record some vital signs of a patient at certain times of the day. Table 1 records: 01:30-HR (128), HXPL (19), 05:00-HR (124), HXPL (20). Table 2 records: 01:30-CVP (7), SBP (129) and DBP (60), 09:30-CVP (6.5), SBP (112) and DBP (63). It can be determined that the current time series data is not aligned.

[0098] Furthermore, the current time series data is aligned according to the preset time alignment rules. The preset time alignment rules refer to the rules set in advance to merge two time lines onto one time axis. That is, the data in Table 1 and Table 2 for the time period of 01:30 are aligned according to the preset time alignment rules: 01:30-HR (128), HXPL (19), CVP (7), SBP (129) and DBP (60). Since there are no relevant data records in Table 1 at 09:30 and no relevant data records in Table 2 at 05:00, None is directly used to represent them. Thus, 09:30-None, None, CVP (6.5), SBP (112) and DBP (63), 05:00-HR (124), HXPL (20), None, None, None.

[0099] The database adaptation method provided in this embodiment aligns the current time series data according to a preset time alignment rule, thereby enhancing the analysis effect of related data in the database and saving database resource allocation.

[0100] In one embodiment of this example, such as Figure 4 As shown, step S303, which aligns the current time series data according to the preset time alignment rules if the current time series data is not aligned, includes the following steps:

[0101] S401. If the current time series data is not aligned, obtain the amount of data at the same time point corresponding to the current time series data according to the preset time alignment rules;

[0102] S402. Based on the amount of data at the same time point, set the alignment priority corresponding to the current time series data. The amount of data at the same time point is proportional to the alignment priority.

[0103] S403. Align the current time series data according to the alignment priority.

[0104] In practical applications, in order to improve the alignment efficiency of time series data, the amount of data at the same time point corresponding to the current time series data is further obtained. The amount of data at the same time point refers to the number of data corresponding to the same time axis. The alignment priority corresponding to the current time series data is set according to the amount of data at the same time point. The amount of data at the same time point is directly proportional to the alignment priority, that is, the more data at the same time point, the higher the alignment priority.

[0105] For example, in Tables 1 and 2 mentioned above, the 05:00 and 09:30 timelines need to be aligned. Further analysis shows that there are 2 data points corresponding to the same time point at 05:00 and 3 data points corresponding to the same time point at 09:30. Therefore, the alignment priority of the current time series data corresponding to the 09:30 timeline is higher than that of the current time series data corresponding to the 05:00 timeline. Thus, the alignment of the current time series data corresponding to the 09:30 timeline is prioritized.

[0106] The database adaptation method provided in this embodiment can prioritize aligning data with a large amount of data at the same time point based on alignment priority, thereby improving the classification efficiency of similar data in the database and saving database resources.

[0107] In one embodiment of this example, such as Figure 5 As shown, step S107, which involves obtaining and switching to the corresponding target database based on the preset configuration information corresponding to the database type if no connection information exists in the historical connection records, includes the following steps:

[0108] S501. If there is no connection information in the historical connection records, obtain the predefined connection information corresponding to the database type according to the preset configuration information;

[0109] S502. Switch to the corresponding target database based on the predefined connection information.

[0110] In practical applications, in order to improve the efficiency of database switching, if the corresponding connection information is not found in the historical connection records, the predefined connection information corresponding to the database type is obtained according to the preset configuration information. The predefined connection information refers to the connection information that is defined for the database in advance.

[0111] For example, the predefined database connection information, including the database number and database configuration, can be set by calling the db method of the Model class. The database number is in numeric format. For the default database connection, the internal database number is 0. Therefore, to avoid conflicts, the database configuration with the database number 0 is not defined.

[0112] Furthermore, a database connection numbered 1 was added using the db method. When switching to database 1 is required, the corresponding database configuration for database 1 can be called to complete the switch. When switching to the default database connection is required, the corresponding database configuration for database 0 can be called to complete the switch.

[0113] The database adaptation method provided in this embodiment can quickly switch to the corresponding target database if there is no connection information in the historical connection records, thereby improving the database switching efficiency.

[0114] In one embodiment of this example, such as Figure 6 As shown, after step S102, which involves reading the current configuration file and generating the corresponding driver information, the following steps are also included:

[0115] S601. If the driver information parsing fails, record the error field corresponding to the driver information;

[0116] S602. Generate corresponding exception identification information based on the error field.

[0117] In practical applications, in order to quickly verify the corresponding driver information in the configuration file, when the driver information parsing fails, the error field corresponding to the driver information is recorded, and the corresponding exception identification information is generated based on the information displayed in the error field.

[0118] For example, if the current configuration file generates the corresponding driver information as "database error", it means that the driver information parsing failed. "Database error" is the error field corresponding to the driver information. The system will then further obtain the database type or generate the corresponding warning exception identification information based on the "database error".

[0119] The database adaptation method provided in this embodiment indicates that if the driver information parsing fails, it means that the login information or basic information of the current database is incorrect. Furthermore, it generates corresponding abnormal identification information based on the corresponding error fields. Based on the abnormal identification information, relevant personnel can be promptly reminded to search and repair the current configuration file, thereby improving the repair efficiency of abnormal configuration files.

[0120] In one embodiment of this example, such as Figure 7 As shown, after step S102, which involves reading the current configuration file and generating the corresponding driver information, the following steps are also included:

[0121] S701. If the driver information parsing fails, obtain the corresponding basic database information;

[0122] S702. If the basic information of the database does not conform to the preset configuration information, the corresponding abnormal configuration information item is obtained and the corresponding prompt information is generated.

[0123] In practical applications, in order to further understand the reason for the failure of driver information parsing, the system obtains the corresponding basic database information based on the error fields that appear. Furthermore, if the basic database information does not conform to the corresponding preset configuration information, it means that the basic database information does not conform to the preset configuration information of the database. The preset configuration information refers to the pre-set database configuration information.

[0124] Furthermore, the corresponding abnormal configuration information item is obtained, and the corresponding prompt information is generated. For example, if the abnormal configuration information item is the IP address of the database, the corresponding prompt information is generated based on the IP address.

[0125] The database adaptation method provided in this embodiment indicates that there is an abnormal error in the basic information of the database if the basic information of the database does not conform to the preset configuration information. The corresponding abnormal information items are then obtained and corresponding prompt information is generated. Based on the prompt information, the specific abnormal information items can be obtained, thereby improving the repair efficiency of the basic configuration information of the database.

[0126] This application discloses an adapted database system, such as... Figure 8 As shown, it includes:

[0127] The first acquisition module 1 is used to acquire the current configuration file;

[0128] Module 2 is used to read the current configuration file and generate the corresponding driver information;

[0129] If the driver information is successfully parsed, the second acquisition module 3 is used to acquire and connect to the corresponding database type.

[0130] Parsing module 4 is used to parse the database type and obtain the corresponding connection information;

[0131] The judgment module 5 is used to determine whether there is connection information in the historical connection records based on the processing requirements of the current data to be processed;

[0132] If connection information exists in the historical connection record, the first switching module 6 is used to switch to the corresponding target database according to the connection information.

[0133] If the historical connection record does not contain connection information, the second switching module 7 is used to obtain and switch to the corresponding target database according to the preset configuration information corresponding to the database type.

[0134] The adapted database system provided in this embodiment indicates that a successful connection to the corresponding database has been achieved if the driver information corresponding to the current configuration file is successfully parsed. Simultaneously, the database type of the current connection can be determined through the information in the current configuration file. Further parsing of the current database type allows the parsing module 4 to obtain connection information for various database types. Then, the judgment module 5, combined with the processing requirements of the current data to be processed, determines whether connection information corresponding to the aforementioned database type exists in the historical connection records. If connection information exists in the historical connection records, the first switching module 6 directly switches to the corresponding target database based on the connection information. If no connection information exists in the historical connection records, the second switching module 7 obtains the preset configuration information corresponding to the current database type, and then obtains the connection configuration information corresponding to the current database type based on the preset configuration information. Finally, the system switches to the corresponding target database based on this connection configuration information. Since the type of the currently connected database can be identified by reading the configuration file, the system can quickly switch to the corresponding target database based on the processing requirements of the current data to be processed and the connection information of the currently connected database, thereby improving the database switching efficiency.

[0135] It should be noted that the adapted database system provided in this application embodiment also includes each module and / or corresponding sub-module corresponding to the logical function or logical step of any of the above-mentioned adapted database methods, to achieve the same effect as each logical function or logical step, which will not be elaborated here.

[0136] This application also discloses a terminal device, including a memory, a processor, and computer instructions stored in the memory and capable of running on the processor, wherein the processor executes the computer instructions using any of the database adaptation methods described in the above embodiments.

[0137] The terminal device can be a computer device such as a desktop computer, a laptop computer, or a cloud server. The terminal device includes, but is not limited to, a processor and a memory. For example, the terminal device may also include input / output devices, network access devices, and buses.

[0138] The processor can be a central processing unit (CPU). Of course, depending on the actual use, it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), off-the-shelf programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc., and this application does not limit it.

[0139] The memory can be an internal storage unit of the terminal device, such as a hard disk or RAM of the terminal device, or an external storage device of the terminal device, such as a plug-in hard disk, smart memory card (SMC), secure digital card (SD), or flash memory card (FC) equipped on the terminal device. Furthermore, the memory can be a combination of internal storage units and external storage devices of the terminal device. The memory is used to store computer instructions and other instructions and data required by the terminal device. The memory can also be used to temporarily store data that has been output or will be output. This application does not limit this.

[0140] In this terminal device, any one of the adapted database methods in the above embodiments is stored in the terminal device's memory and loaded and executed on the terminal device's processor for convenient use.

[0141] This application also discloses a computer-readable storage medium, which stores computer instructions, wherein when the computer instructions are executed by a processor, any of the database adaptation methods described in the above embodiments are employed.

[0142] The computer instructions can be stored in a computer-readable medium. The computer instructions include computer instruction code, which can be in the form of source code, object code, executable file, or certain middleware. The computer-readable medium includes any entity or device capable of carrying computer instruction code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the computer-readable medium includes, but is not limited to, the above-mentioned components.

[0143] In this computer-readable storage medium, any of the adaptive database methods in the above embodiments can be stored in the computer-readable storage medium and loaded and executed on the processor to facilitate the storage and application of the above methods.

[0144] The above are all preferred embodiments of this application, and are not intended to limit the scope of protection of this application. Therefore, all equivalent changes made in accordance with the structure, shape and principle of this application should be covered within the scope of protection of this application.

Claims

1. A database adaptation method, characterized in that, Includes the following steps: Get the current configuration file; Read the current configuration file and generate the corresponding driver information; If the driver information is successfully parsed, the corresponding database type is obtained and connected. Parse the database type to obtain the corresponding connection information; Based on the processing requirements of the current data to be processed, determine whether the connection information exists in the historical connection records; If the connection information exists in the historical connection record, the corresponding database number is obtained based on the connection information; the database number is identified to obtain the corresponding historical switching instruction; the connection is switched to the corresponding target database according to the historical switching instruction, and the connection information of the target database does not need to be passed in during this process. Obtain the current time series data corresponding to the target database; Determine whether the current time series data is aligned; If the current time series data is not aligned, the amount of data at the same time point corresponding to the current time series data is obtained according to the preset time alignment rules; based on the amount of data at the same time point, the alignment priority corresponding to the current time series data is set, and the amount of data at the same time point is proportional to the alignment priority. The current time series data is aligned according to the alignment priority. If the connection information is not found in the historical connection records, then the predefined connection information corresponding to the database type is obtained according to the preset configuration information; and the corresponding target database is switched according to the predefined connection information.

2. The database adaptation method according to claim 1, characterized in that, After reading the current configuration file and generating the corresponding driver information, the following steps are also included: If the driver information parsing fails, the error field corresponding to the driver information is recorded; Based on the error field, generate corresponding exception identification information.

3. The database adaptation method according to claim 1, characterized in that, After reading the current configuration file and generating the corresponding driver information, the following steps are also included: If the driver information parsing fails, then obtain the corresponding basic database information; If the basic information of the database does not conform to the preset configuration information, the corresponding abnormal configuration information item is obtained and the corresponding prompt information is generated.

4. An adaptation database system, characterized in that, To implement the method according to any one of claims 1 to 3, the method comprises: The first acquisition module is used to acquire the current configuration file; The reading module is used to read the current configuration file and generate corresponding driver information; If the driver information is successfully parsed, the second acquisition module is used to acquire and connect to the corresponding database type. The parsing module is used to parse the database type and obtain the corresponding connection information; The judgment module is used to determine whether the connection information exists in the historical connection records based on the processing requirements of the current data to be processed; The first switching module, if the connection information exists in the historical connection record, obtains the corresponding database number based on the connection information; identifies the database number and obtains the corresponding historical switching instruction; switches to the corresponding target database according to the historical switching instruction, without needing to input the connection information of the target database again during this process; obtains the current time series data corresponding to the target database; determines whether the current time series data is aligned; if the current time series data is not aligned, obtains the amount of data at the same time point corresponding to the current time series data according to a preset time alignment rule; sets the alignment priority corresponding to the current time series data based on the amount of data at the same time point, wherein the amount of data at the same time point is proportional to the alignment priority; and aligns the current time series data according to the alignment priority. The second switching module, if the connection information is not found in the historical connection records, obtains the predefined connection information corresponding to the database type according to the preset configuration information; and switches to the corresponding target database according to the predefined connection information.

5. A terminal device, comprising a memory and a processor, characterized in that, The memory stores computer instructions that can run on the processor, and when the processor loads and executes the computer instructions, it employs an adaptive database method as described in any one of claims 1 to 3.

6. A computer-readable storage medium storing computer instructions, characterized in that, When the computer instructions are loaded and executed by the processor, an adaptive database method as described in any one of claims 1 to 3 is employed.