Database compatibility method and device, electronic equipment, system and storage medium
By obtaining and parsing compatibility rules for multiple database interfaces and query languages in the middleware adaptation layer, determining the target database, and performing data migration, the problem of lack of flexibility and scalability of a single data source is solved, and the database is highly compatible and fast responsive.
Patent Information
- Application Number
- CN202411705709.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2044-11-26
AI Technical Summary
A single data source in the prior art lacks flexibility and scalability and cannot respond quickly to changes in markets and policies.
By introducing the middleware adaptation layer, we obtain the analysis results of the configuration management layer and the management database compatibility rules of the management library connection layer, determine the target database, and improve the compatibility and flexibility of the database through data migration.
It realizes flexible database determination based on multiple database interfaces and query languages, improves database compatibility and responsiveness, ensures data integrity and quickly adapt to market changes.
Smart Images

Figure CN119938749A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a database compatibility method, device, electronic equipment, system and storage medium. Background Art
[0002] With the improvement of information security awareness and the promotion of localization policies, more and more industries and regions are beginning to require the use of databases.
[0003] At present, in the existing technology, the differences in interfaces and query languages between different databases cause the system to require complex adaptation and reconstruction problems when switching databases. Usually, when facing customer needs, the system is based on a single data source to meet customer demand changes. However, this single data source lacks flexibility and scalability and cannot quickly respond to market and policy changes. Summary of the invention
[0004] The present invention provides a database compatibility method, device, electronic device, system and storage medium, which are used to solve the defects of the single data source in the prior art that lacks flexibility and scalability and cannot quickly respond to market and policy changes, and realizes flexible determination of the target database based on the correspondence between at least two database interfaces, at least two database query languages and parsing results, and improves the compatibility and flexibility of the database by migrating the data of the target database.
[0005] The present invention provides a database compatibility method, which is applied to a middleware adaptation layer and includes the following steps.
[0006] Obtain the parsing results of the configuration management layer and the management database compatibility rules of the management library connection layer; wherein the parsing results are the results of the configuration management layer parsing the configuration file obtained by the operation and maintenance layer, and the management database compatibility rules include the correspondence between at least two database interfaces set by the management library connection layer, at least two database query languages and the parsing results.
[0007] The target database is determined according to the corresponding relationship between the parsing result and the management database compatibility rule; wherein the target database refers to a database that is compatible with the parsing result in the corresponding relationship.
[0008] The target database is sent to the data migration layer through the business logic layer, and the data migration results fed back by the data migration layer are received.
[0009] Feedback the target database and data migration results to the operation and maintenance layer.
[0010] According to a database compatibility method provided by the present invention, a target database is determined according to a corresponding relationship between a parsing result and a management database compatibility rule, comprising: receiving a business request sent by a client; wherein a business request refers to a request containing business content and business attributes; according to the parsing result, the business content and the business attributes, determining a database interface and a database query language corresponding to the business content and the business attributes from the corresponding relationship in the management database compatibility rule; and determining a target database according to the database interface and the database query language.
[0011] According to a database compatibility method provided by the present invention, a target database and a business request are sent to a data migration layer through a business logic layer, and a data migration result fed back by the data migration layer is received, including: sending a business request and a target database to the business logic layer, so that the business logic layer executes business logic based on the business request and the target database, obtains a business execution result, and sends the business execution result to the data migration layer; receiving the data migration result fed back by the data migration layer; wherein the data migration result is a result obtained by the data migration layer migrating the business execution result.
[0012] The present invention also provides a database compatibility method, which is applied to a data migration layer and includes the following steps.
[0013] Receive the business execution result sent by the business logic layer; wherein the business execution result is obtained by the business logic layer executing the business logic according to the target database and business request determined by the management database compatibility rule obtained from the middleware adaptation layer.
[0014] When database switching is required, data migration and synchronization operations are performed on the business execution results to obtain data migration results.
[0015] Feedback the data migration results to the middleware adaptation layer.
[0016] According to a database compatibility method provided by the present invention, when database switching is required, data migration and synchronization operations are performed on the business execution results. After the data migration results are obtained, the method further includes: feeding back the data migration results to the database connection layer, so that the database connection layer determines whether the data migration layer has completed the migration of the business execution results based on the data migration results.
[0017] The present invention also provides a database compatibility device, which is applied to the middleware adaptation layer and includes the following modules.
[0018] The result acquisition module is used to obtain the parsing results of the configuration management layer and the management database compatibility rules of the management library connection layer; wherein the parsing results are the results of the configuration management layer parsing the configuration files obtained by the operation and maintenance layer, and the management database compatibility rules include the correspondence between the database interface and database query language set by the management library connection layer and the parsing results.
[0019] The database determination module is used to determine the target database according to the corresponding relationship between the analysis result and the management database compatibility rule; wherein the target database refers to the database that is adapted to the analysis result in the corresponding relationship.
[0020] The database sending module is used to send the target database to the data migration layer through the business logic layer and receive the data migration results fed back by the data migration layer.
[0021] The database feedback module is used to feed back the target database and data migration results to the operation and maintenance layer.
[0022] The present invention also provides a database compatibility device, which is applied to a data migration layer and includes the following modules.
[0023] The result receiving module is used to receive the business execution result sent by the business logic layer; wherein the business execution result is obtained by the business logic layer executing the business logic according to the target database and business request determined by the management database compatibility rule obtained from the middleware adaptation layer.
[0024] The data migration layer is used to perform data migration and synchronization operations on business execution results to obtain data migration results when database switching is required.
[0025] The result feedback module is used to feed back the data migration results to the middleware adaptation layer.
[0026] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the above-mentioned database compatibility methods when executing the computer program.
[0027] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, any of the above-mentioned database compatibility methods is implemented.
[0028] The present invention also provides a computer program product, including a computer program, and when the computer program is executed by a processor, any of the above-mentioned database compatibility methods is implemented.
[0029] The present invention provides a database compatibility method, device, electronic device, system and storage medium, which obtain the parsing result of the configuration management layer and the management database compatibility rule of the management library connection layer; wherein the parsing result is the result of the configuration management layer parsing the configuration file obtained by the operation and maintenance layer, and the management database compatibility rule includes at least two database interfaces set by the management library connection layer, at least two database query languages and the corresponding relationship between the parsing result; the target database is determined according to the parsing result and the management database compatibility rule; wherein the target database refers to the database used to execute adaptation with the parsing result; the target database is sent to the data migration layer through the business logic layer, and the data migration result fed back by the data migration layer is received; the target database and the data migration result are fed back to the operation and maintenance layer. The technical solution of the present invention is used to solve the defects of the single data source in the prior art that lacks flexibility and scalability and cannot quickly respond to changes in the market and policies. It is achieved by introducing a middleware adaptation layer, receiving the correspondence between at least two database interfaces, at least two database query languages and parsing results through the middleware adaptation layer, further parsing and matching different database interfaces and database query languages, and determining the corresponding target database according to different parsing results, thereby realizing flexible determination of the database and improving the compatibility of the database. In addition, the business logic of the target database is executed based on the business logic layer, and the database is seamlessly switched based on the business execution results, thereby improving the flexibility of the database. Data migration is further performed based on the business execution results to ensure the integrity of the database. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0031] Figure 1 This is one of the flow charts of the database compatibility method provided by the present invention.
[0032] Figure 2 This is the second flow chart of the database compatibility method provided by the present invention.
[0033] Figure 3 This is one of the structural schematic diagrams of the database compatible device provided by the present invention.
[0034] Figure 4 This is the second structural schematic diagram of the database compatible device provided by the present invention.
[0035] Figure 5 It is a structural schematic diagram of the database compatible system provided by the present invention.
[0036] Figure 6 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0038] Combine the following Figure 1 The database compatibility method provided by the present invention is described. The database compatibility method provided by the present invention can be applicable to the database compatibility situation of multiple data. The executor of the method can be an electronic device, the electronic device is a middleware adaptation layer, and it can also be a database compatibility device set in the electronic device. The database compatibility device can be implemented by software, hardware or a combination of both. Figure 1 This is one of the flow charts of the database compatibility method provided by the present invention, such as Figure 1 As shown, the method includes the following steps 101, 102, 103 and 104.
[0039] Step 101: Obtain the parsing result of the configuration management layer and the management database compatibility rules of the management database connection layer.
[0040] The parsing result is the result of the configuration management layer parsing the configuration file obtained by the operation and maintenance layer, and the management database compatibility rules include at least two database interfaces set by the management library connection layer, at least two database query languages and the corresponding relationship with the parsing results. For the management database compatibility rules, which include multiple databases and the database interfaces and database query languages corresponding to the multiple databases and the corresponding relationship with the parsing results, different functions correspond to different types and mode requirements of databases. Customers hope to support multiple databases at the same time through configuration. For example, business data can be suitable for storage in a database that supports complex queries, topology and other data can be suitable for storage in a database that supports spatial data, and alarms and logs can be suitable for storage in a time series database. This embodiment does not limit this.
[0041] Specifically, the operation and maintenance layer obtains customer requirements, determines the configuration file based on the customer requirements, and then the configuration management layer parses the configuration file obtained by the operation and maintenance layer to obtain the parsing result, and at the same time obtains the management database compatibility rules from the management library connection layer. The management database compatibility rules include at least two database interfaces set by the management library connection layer, at least two database query languages and the correspondence between the parsing results.
[0042] The advantage of this setting is that, through dynamic configuration files based on customer needs, different functional data can be saved in different databases, which improves the flexibility of the database, and based on the analysis of the configuration files, it is conducive to the rapid switching of subsequent databases.
[0043] Furthermore, after the configuration file is determined, the configuration management layer parses and analyzes the configuration file, mainly by modifying the data source configuration, connection parameter configuration, and the type of database corresponding to the specific function in the configuration file, so as to obtain the parsing result. For example, it may be found in customer demand that a certain function currently stored in database A is more suitable to be stored in database B, and the function can be quickly switched to database B by simply modifying the configuration.
[0044] For example, it is presented in the format of Extensible Markup Language (XML): <database name="A" type(A类型)="空间数据处理" / > , <database name="B" type(B类型)="业务数据处理" / > , <database name="C" type(C类型)="时序数据处理" / > wait.
[0045] Step 102: Determine the target database according to the corresponding relationship between the parsing result and the management database compatibility rule.
[0046] In this step, the target database refers to a database that is compatible with the parsing result in the corresponding relationship.
[0047] Specifically, after obtaining the parsing result and the management database compatibility rule, the target database is determined according to the corresponding relationship in the parsing result and the management database compatibility rule.
[0048] In a specific implementation, determining a target database based on a correspondence between a parsing result and a management database compatibility rule includes: receiving a business request sent by a client; wherein a business request refers to a request including business content and business attributes; determining a database interface and a database query language corresponding to the business content and business attributes from a correspondence between the management database compatibility rule and the parsing result, the business content and the business attributes; and determining a target database based on the database interface and the database query language.
[0049] In this step, the business request is to query data by calling a unified interface. The business request refers to a request containing business content and business attributes. The business content specifically includes business functions such as query, add, modify, delete, etc. This embodiment does not limit this.
[0050] Specifically, receive the business request sent by the client, determine the specific business content and business attributes based on the business request, then determine the database interface and database query language corresponding to the parsing results, business content and business attributes from the corresponding relationship of the management database compatibility rules, and determine the target database based on the database interface and database query language.
[0051] For example, when there are two databases in the management database compatibility rules, the two databases are database A and database B, database A is good at processing complex business logic, and database B focuses on time series data processing. If complex logic is required, it is saved in database A, and if time series data needs to be processed, it is saved in database B. That is, when the corresponding target database is determined from the management database compatibility rules according to the parsing results, business content and business attributes, first, the corresponding database interface and database query language are determined according to the parsing results and business requests, and then the database connection pool, database interface and database query language are used to manage the database connection resources to achieve the connection operation with the database.
[0052] Step 103: Send the target database to the data migration layer through the business logic layer, and receive the data migration result fed back by the data migration layer.
[0053] Specifically, after the target database is determined, the target database is sent to the data migration layer through the business logic layer, and the data migration result fed back by the data migration layer is received.
[0054] In a specific implementation, the target database and the business request are sent to the data migration layer through the business logic layer, and the data migration result fed back by the data migration layer is received, including: sending the business request and the target database to the business logic layer so that the business logic layer executes the business logic based on the business request and the target database, obtains the business execution result, and sends the business execution result to the data migration layer; receiving the data migration result fed back by the data migration layer; wherein the data migration result is the result obtained by the data migration layer migrating the business execution result.
[0055] In this step, the data migration result is used to determine whether the quantity of each data is consistent with the original database to ensure the integrity of the migrated data.
[0056] Specifically, after determining the target database, the middleware adaptation layer obtains the business request based on the client, and the middleware adaptation layer sends the business request to the business logic layer, so that the business logic layer executes the business logic based on the received business request and obtains the business execution result. The middleware adaptation layer plays the role of adapting and transmitting requests between the client and the business logic layer to achieve the correct execution of the business logic. Further, the business execution result is sent to the data migration layer, so that the data migration layer performs related migration operations such as querying, adding or deleting data based on the business request and the business execution result, such as verifying the user input information, and finally obtains the data migration result.
[0057] Step 104: Feedback the target database and data migration results to the operation and maintenance layer.
[0058] Specifically, after obtaining the migration results and the target database, the target database and the data migration results are fed back to the operation and maintenance layer, so that the operation and maintenance layer determines whether the data migration is completed based on the migration results, and determines the target database corresponding to the customer's needs.
[0059] A database compatibility method provided by the present invention is applied to the middleware adaptation layer, by obtaining the parsing result of the configuration management layer and the management database compatibility rule of the management library connection layer; wherein the parsing result is the result of the configuration management layer parsing the configuration file obtained by the operation and maintenance layer, and the management database compatibility rule includes at least two database interfaces set by the management library connection layer, at least two database query languages and the corresponding relationship between the parsing result; the target database is determined according to the parsing result and the corresponding relationship in the management database compatibility rule; wherein the target database refers to the database adapted to the parsing result in the corresponding relationship; the target database is sent to the data migration layer through the business logic layer, and the data migration result fed back by the data migration layer is received; the target database and the data migration result are fed back to the operation and maintenance layer. The technical solution of the present invention is used to solve the defects of the single data source in the prior art that lacks flexibility and scalability and cannot quickly respond to changes in the market and policies, and realizes the flexible determination of the target database based on the corresponding relationship including at least two database interfaces, at least two database query languages and the parsing result, and improves the compatibility and flexibility of the database by migrating the data of the target database.
[0060] Combine the following Figure 2 The database compatibility method provided by the present invention is described. The database compatibility method provided by the present invention can be applicable to the database compatibility of multiple data. The execution subject of the method can be an electronic device, the electronic device is a data migration layer, and it can also be a database compatibility device set in the electronic device. The database compatibility device can be implemented by software, hardware or a combination of both. Figure 2This is the second flow chart of the database compatibility method provided by the present invention, such as Figure 2 As shown, the method includes the following steps 201, 202 and 203.
[0061] Step 201: Receive the business execution result sent by the business logic layer.
[0062] In this step, the service execution result is obtained by the service logic layer executing the service logic according to the target database and service request determined by the management database compatibility rule obtained from the middleware adaptation layer.
[0063] Specifically, the middleware adaptation layer obtains the target database determined by the management database compatibility rule and the business request to execute the business logic to obtain the business execution result, and feeds the business execution result back to the data migration layer.
[0064] Step 202: When database switching is required, data migration and synchronization operations are performed on the business execution results to obtain data migration results.
[0065] In this step, the target database refers to the database used to perform adaptation with the analysis result. The migration and synchronization operations may be, for example, querying, adding or deleting data, and performing related data processing, calculation, judgment and other database-related operations, which are not limited in this embodiment.
[0066] Specifically, after receiving the business execution result, it is determined whether a database switch is required based on the business execution result. If a database switch is required, data migration and synchronization operations are performed on the business execution result to obtain a data migration result.
[0067] Step 203: Feedback the data migration result to the middleware adaptation layer.
[0068] In this step, the data migration result is the result obtained by the data migration layer after migrating the business execution result.
[0069] Specifically, after obtaining the data migration result, the data migration result is fed back to the middleware adaptation layer, so that the middleware adaptation layer determines the data migration status based on the data migration result.
[0070] In a specific embodiment, when database switching is required, data migration and synchronization operations are performed on the business execution results. After the data migration results are obtained, the method also includes: feeding back the data migration results to the database connection layer, so that the database connection layer determines whether the data migration layer has completed the migration of the business execution results based on the data migration results.
[0071] Specifically, when database switching is required, data migration and synchronization operations are performed on the business execution results. After the data migration results are obtained, the data migration results are fed back to the database connection layer, so that the database connection layer determines whether the data migration layer has completed the migration of the business execution results based on the data migration results.
[0072] The advantage of this setting is that you can keep track of data migration status in a timely manner and improve the user experience.
[0073] The present invention provides a database compatibility method, which is applied to the data migration layer, by receiving the business execution result sent by the business logic layer; wherein the business execution result is obtained by the business logic layer executing the business logic according to the target database and business request determined by the management database compatibility rules obtained from the middleware adaptation layer; in the case of database switching, data migration and synchronization operations are performed on the business execution result to obtain the data migration result; the data migration result is fed back to the middleware adaptation layer. The technical solution of the present invention is used to solve the defects of the single data source in the prior art that lacks flexibility and scalability and cannot quickly respond to market and policy changes, and realizes data migration and synchronization operations based on the business logic layer executing the business logic according to the target database and business request determined by the management database compatibility rules obtained from the middleware adaptation layer to obtain the data migration result, and determines whether the data is completely migrated based on the data migration result, thereby improving the compatibility and flexibility of the database.
[0074] The database compatibility device provided by the present invention is described below, which is applied to the middleware adaptation layer. The database compatibility device described below and the database compatibility method described above can be referenced to each other.
[0075] Figure 3 This is one of the structural diagrams of the database compatible device provided by the present invention, referring to Figure 3 As shown, the database compatibility device includes: a result acquisition module 301, a database determination module 302, a database sending module 303 and a database feedback module 304.
[0076] The result acquisition module 301 is used to obtain the parsing results of the configuration management layer and the management database compatibility rules of the management library connection layer; wherein the parsing results are the results of the configuration management layer parsing the configuration files obtained by the operation and maintenance layer, and the management database compatibility rules include the correspondence between the database interface and database query language set by the management library connection layer and the parsing results.
[0077] The database determination module 302 is used to determine the target database according to the corresponding relationship between the analysis result and the management database compatibility rule; wherein the target database refers to the database that is compatible with the analysis result in the corresponding relationship.
[0078] The database sending module 303 is used to send the target database to the data migration layer through the business logic layer, and receive the data migration result fed back by the data migration layer.
[0079] The database feedback module 304 is used to feed back the target database and data migration results to the operation and maintenance layer.
[0080] In an exemplary embodiment, the database determination module 302 is specifically used to: receive a business request sent by a client; wherein the business request refers to a request containing business content and business attributes; determine the database interface and database query language corresponding to the business content and business attributes from the corresponding relationship of the management database compatibility rules based on the parsing results, business content and business attributes; determine the target database based on the database interface and database query language.
[0081] In an exemplary embodiment, the database sending module 303 is specifically used to: send the business request and the target database to the business logic layer, so that the business logic layer executes the business logic based on the business request and the target database, obtains the business execution result, and sends the business execution result to the data migration layer; receive the data migration result fed back by the data migration layer; wherein the data migration result is the result obtained by the data migration layer migrating the business execution result.
[0082] The device of this embodiment can be used to execute the method of any embodiment in the database compatible method side embodiment. Its specific implementation process and technical effects are similar to those in the database compatible method side embodiment. For details, please refer to the detailed description in the database compatible method side embodiment, which will not be repeated here.
[0083] The database compatibility device provided by the present invention is described below, which is applied to the data migration layer. The database compatibility device described below and the database compatibility method described above can be referenced to each other.
[0084] Figure 4 This is the second structural diagram of the database compatible device provided by the present invention, referring to Figure 4 As shown, the database compatible device includes: a result receiving module 401 , a data migration layer 402 and a result feedback module 403 .
[0085] The result receiving module 401 is used to receive the business execution result sent by the business logic layer; wherein the business execution result is obtained by the business logic layer executing the business logic according to the target database and business request determined by the management database compatibility rule obtained from the middleware adaptation layer.
[0086] The data migration layer 402 is used to perform data migration and synchronization operations on the business execution results to obtain data migration results when database switching is required.
[0087] The result feedback module 403 is used to feed back the data migration result to the middleware adaptation layer.
[0088] In an example embodiment, the device further includes: a migration result feedback module. The migration result feedback module is used to perform data migration and synchronization operations on the business execution results when database switching is required, and after obtaining the data migration results, feed back the data migration results to the database connection layer, so that the database connection layer determines whether the data migration layer has completed the migration of the business execution results based on the data migration results.
[0089] The device of this embodiment can be used to execute the method of any embodiment in the database compatible method side embodiment. Its specific implementation process and technical effects are similar to those in the database compatible method side embodiment. For details, please refer to the detailed description in the database compatible method side embodiment, which will not be repeated here.
[0090] Figure 5 is a schematic diagram of the structure of the database compatible system provided by the present invention, such as Figure 5 As shown, the database compatible system includes an operation and maintenance layer, a configuration management layer, a middleware adaptation layer applied in the database compatible method, a database connection layer, a business logic layer, a data migration layer applied in the database compatible method and a client. The specific implementation steps include the following.
[0091] Step 501: Obtain customer needs.
[0092] In this step, customer requirements refer to requirements that include configuration changes to the database.
[0093] Specifically, the operation and maintenance layer obtains customer requirements including configuration modification of the database, and sends the customer requirements to the configuration management layer.
[0094] Step 502: Determine the configuration file.
[0095] In this step macro, the configuration file contains the specific content for configuring the database.
[0096] Specifically, the configuration management layer receives customer requirements and determines configuration files based on the customer requirements. After determining the configuration files, the configuration management layer sends the configuration files to the middleware adaptation layer.
[0097] Step 503: Determine the analysis result.
[0098] In this step, the parsing result is the result of the configuration management layer parsing the configuration file obtained by the operation and maintenance layer.
[0099] Specifically, the middleware adaptation layer receives the configuration file sent by the configuration management layer, and then parses the configuration file, modifies the data source configuration, connection parameter configuration and the type of database corresponding to the specific function in the configuration file, so as to obtain the parsing result.
[0100] Step 504: Receive management database compatibility rules.
[0101] In this step, the management database compatibility rules include the correspondence between at least two database interfaces set by the management library connection layer, at least two database query languages and the parsing results.
[0102] Specifically, the management database connection layer determines the management database compatibility rule, and sends the management database compatibility rule to the middleware adaptation layer.
[0103] Step 505: Receive a service request.
[0104] In this step, the service request refers to a request including service content and service attributes.
[0105] Specifically, the client obtains the service request and sends the service request to the middleware adaptation layer.
[0106] Step 506: Determine the target database.
[0107] Specifically, the target database is determined according to the business request, the management database compatibility rules and the parsing results. That is, after the middleware adaptation layer obtains the business request, the management database compatibility rules and the parsing results to determine the target database, it determines the specific business content and business attributes according to the business request, and then determines the database interface and database query language corresponding to the parsing results, business content and business attributes from the management database compatibility rules, and determines the target database according to the database interface and database query language.
[0108] Step 507: Send the target database and service request.
[0109] Specifically, after the target database is determined, the target database and the business request are sent to the business logic layer.
[0110] Step 508: Determine the business execution result.
[0111] Specifically, after the business logic layer receives the target database and the business request, the business logic layer executes the business logic based on the received business request and the target database to obtain the business execution result. The middleware adaptation layer plays the role of adapting and transmitting the request between the client and the business logic layer to achieve the correct execution of the business logic. Further, it is determined whether the database switching is required according to the business execution result. If the database switching is required, continue to execute step 509.
[0112] Step 509: Send the service execution result.
[0113] Specifically, the service execution result is sent to the data migration layer, and step 510 is continued.
[0114] Step 510: Determine the data migration result.
[0115] Specifically, after receiving the service execution result, the data migration layer performs data migration and synchronization operations on the service execution result to obtain the data migration result, and then continues to execute step 511 .
[0116] Step 511: Send data migration results.
[0117] Specifically, the data migration module sends the data migration result to the database connection layer, so that the database connection layer ensures data consistency based on the data migration result.
[0118] Step 512: Feedback the data migration result to the middleware adaptation layer.
[0119] Specifically, the database connection layer feeds back the data migration result to the middleware adaptation layer.
[0120] Step 513: Feedback the data migration results and the target database to the operation and maintenance layer.
[0121] Specifically, after obtaining the data migration result and the target database, the middleware adaptation layer feeds back the data migration result and the target database to the operation and maintenance layer.
[0122] The present invention provides a database compatibility system, which obtains customer needs; determines a configuration file according to the customer needs; determines a parsing result according to the configuration file; obtains a management database compatibility rule; obtains a business request; determines a target database according to the business request, the management database compatibility rule and the parsing result; sends the target database and the business request; determines the business execution result; sends the business execution result to the data migration layer; determines the data migration result; sends the data migration result; feeds back the data migration result to the middleware adaptation layer; feeds back the data migration result and the target database to the operation and maintenance layer. The technical scheme of the present invention is used to solve the defects of the single data source in the prior art that lacks flexibility and scalability and cannot quickly respond to changes in the market and policies, and realizes the flexible determination of the target database based on the corresponding relationship between at least two database interfaces, at least two database query languages and the parsing result, and performs data migration and synchronization operations based on the business logic layer according to the target database determined by the management database compatibility rule and the business request obtained from the middleware adaptation layer to execute the business logic to obtain the business execution result, and determines whether the data is completely migrated based on the data migration result, thereby improving the compatibility and flexibility of the database.
[0123] Figure 6 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 6 As shown, the electronic device may include: a processor (processor) 610 , a communication interface (Communications Interface) 620 , a memory (memory) 630 and a communication bus 640 , wherein the processor 610 , the communication interface 620 , and the memory 630 communicate with each other through the communication bus 640 . The processor 610 can call the logic instructions in the memory 630 to execute the database compatibility method, which includes: obtaining the parsing result of the configuration management layer and the management database compatibility rule of the management library connection layer; wherein the parsing result is the result of the configuration management layer parsing the configuration file obtained by the operation and maintenance layer, and the management database compatibility rule includes the correspondence between at least two database interfaces set by the management library connection layer and at least two database query languages and the parsing result; determining the target database according to the parsing result and the correspondence in the management database compatibility rule; wherein the target database refers to the database adapted to the parsing result in the correspondence; sending the target database to the data migration layer through the business logic layer, and receiving the data migration result fed back by the data migration layer; feeding back the target database and the data migration result to the operation and maintenance layer and receiving the business execution result sent by the business logic layer; wherein the business execution result is obtained by the business logic layer executing the business logic according to the target database determined by the management database compatibility rule obtained from the middleware adaptation layer and the business request; when database switching is required, performing data migration and synchronization operations on the business execution result to obtain the data migration result; and feeding back the data migration result to the middleware adaptation layer.
[0124] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0125] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the database compatibility method provided by the above methods, the method including: obtaining the parsing result of the configuration management layer and the management database compatibility rule of the management library connection layer; wherein the parsing result is the result of the configuration management layer parsing the configuration file obtained by the operation and maintenance layer, and the management database compatibility rule includes at least two database interfaces set by the management library connection layer, at least two database query languages and the corresponding relationship between the parsing result; according to the parsing result and the correspondence in the management database compatibility rule The target database is determined by the corresponding relationship; wherein the target database refers to the database that is adapted to the parsing result in the corresponding relationship; the target database is sent to the data migration layer through the business logic layer, and the data migration result fed back by the data migration layer is received; the target database and the data migration result are fed back to the operation and maintenance layer, and the business execution result sent by the business logic layer is received; wherein the business execution result is obtained by the business logic layer executing the business logic according to the target database and the business request determined by the management database compatibility rule obtained from the middleware adaptation layer; when database switching is required, data migration and synchronization operations are performed on the business execution result to obtain the data migration result; the data migration result is fed back to the middleware adaptation layer.
[0126] On the other hand, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it is implemented to execute the database compatibility method provided by the above methods, the method comprising: obtaining the parsing result of the configuration management layer and the management database compatibility rule of the management library connection layer; wherein the parsing result is the result of the configuration management layer parsing the configuration file obtained by the operation and maintenance layer, and the management database compatibility rule includes at least two database interfaces set by the management library connection layer, at least two database query languages and the corresponding relationship between the parsing result; determining the target database according to the parsing result and the corresponding relationship in the management database compatibility rule; wherein the target database refers to the database adapted to the parsing result in the corresponding relationship; sending the target database to the data migration layer through the business logic layer, and receiving the data migration result fed back by the data migration layer; feeding back the target database and the data migration result to the operation and maintenance layer and receiving the business execution result sent by the business logic layer; wherein the business execution result is obtained by the business logic layer executing the business logic according to the target database and the business request determined by the management database compatibility rule obtained from the middleware adaptation layer; when database switching is required, performing data migration and synchronization operations on the business execution result to obtain the data migration result; and feeding back the data migration result to the middleware adaptation layer.
[0127] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0128] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0129] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A database compatibility method, characterized in that: Applied to the middleware adaptation layer, including: Obtaining the parsing result of the configuration management layer and the management database compatibility rule of the management library connection layer; wherein the parsing result is the result of the configuration management layer parsing the configuration file obtained by the operation and maintenance layer, and the management database compatibility rule includes the correspondence between at least two database interfaces and at least two database query languages set by the management library connection layer and the parsing result; Determining a target database according to the corresponding relationship between the analysis result and the management database compatibility rule; wherein the target database refers to a database that is compatible with the analysis result in the corresponding relationship; Sending the target database to the data migration layer through the business logic layer, and receiving the data migration result fed back by the data migration layer; The target database and the data migration result are fed back to the operation and maintenance layer.
2. The database compatibility method according to claim 1, characterized in that: The determining the target database according to the corresponding relationship between the parsing result and the management database compatibility rule includes: Receiving a service request sent by a client; wherein the service request refers to a request including service content and service attributes; According to the analysis result, the business content and the business attribute, determining the database interface and the database query language corresponding to the business content and the business attribute from the corresponding relationship of the management database compatibility rule; The target database is determined according to the database interface and the database query language.
3. The database compatibility method according to claim 1, characterized in that: The sending the target database to the data migration layer through the business logic layer and receiving the data migration result fed back by the data migration layer includes: Sending the service request and the target database to the service logic layer, so that the service logic layer executes service logic based on the service request and the target database, obtains a service execution result, and sends the service execution result to the data migration layer; Receive a data migration result fed back by the data migration layer; wherein the data migration result is a result obtained by the data migration layer migrating the business execution result.
4. A database compatibility method, characterized in that: Applied to the data migration layer, including: Receiving a business execution result sent by the business logic layer; wherein the business execution result is obtained by the business logic layer executing the business logic according to the target database and business request determined by the management database compatibility rule obtained from the middleware adaptation layer; When database switching is required, data migration and synchronization operations are performed on the business execution results to obtain data migration results; Feedback the data migration result to the middleware adaptation layer.
5. The database compatibility method according to claim 4, characterized in that: In the case where database switching is required, data migration and synchronization operations are performed on the business execution results. After the data migration results are obtained, the following steps are also included: The data migration result is fed back to the database connection layer, so that the database connection layer determines whether the data migration layer has completed the migration of the business execution result based on the data migration result.
6. A database compatible device, characterized in that: Applied to the middleware adaptation layer, including: A result acquisition module is used to obtain the parsing result of the configuration management layer and the management database compatibility rules of the management library connection layer; wherein the parsing result is the result of the configuration management layer parsing the configuration file obtained by the operation and maintenance layer, and the management database compatibility rules include the database interface and database query language set by the management library connection layer and the corresponding relationship between the parsing result; A database determination module, configured to determine a target database according to the corresponding relationship between the analysis result and the management database compatibility rule; wherein the target database refers to a database that is compatible with the analysis result in the corresponding relationship; A database sending module, used to send the target database to the data migration layer through the business logic layer, and receive the data migration result fed back by the data migration layer; The database feedback module is used to feed back the target database and the data migration result to the operation and maintenance layer.
7. A database compatible device, characterized in that: Applied to the data migration layer, including: A result receiving module is used to receive the business execution result sent by the business logic layer; wherein the business execution result is obtained by the business logic layer executing the business logic according to the target database and business request determined by the management database compatibility rule obtained from the middleware adaptation layer; The data migration layer is used to perform data migration and synchronization operations on the business execution results to obtain data migration results when database switching is required; The result feedback module is used to feed back the data migration result to the middleware adaptation layer.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the database compatibility method according to any one of claims 1 to 3 and the database compatibility method according to any one of claims 4 to 5 are implemented.
9. A database compatibility system, comprising an operation and maintenance layer, a configuration management layer, a database connection layer, a business logic layer, a client, a middleware adaptation layer applied to the database compatibility method as described in any one of claims 1 to 3, and a data migration layer applied to the database compatibility method as described in any one of claims 4 to 5.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the database compatibility method according to any one of claims 1 to 3 and the database compatibility method according to any one of claims 4 to 5 are implemented.
Citation Information
Patent Citations
Design method for accessing business system by heterogeneous operating system
CN107122187A
Cloud distributed real-time database system
CN110196885A
Database migration method and system
CN115934682A
Passive code application migration adaptation method and device, equipment and storage medium
CN116954714A
Differential database access method and device, electronic equipment and storage medium
CN117131081A