Cross-RDBMS database processing method and device, electronic equipment and medium

By obtaining the target database connection configuration information, using the database metadata management engine and the database driver management engine to determine the target database script and driver package, and optimizing the driver package through dynamic SQL converter, the problem that the MyBat i s framework needs to be bound to a specific database is solved. , realizes efficient calls and cost reduction across RDBMS databases.

CN119127168APending Publication Date: 2024-12-13CHINA TELECOM ARTIFICIAL INTELLIGENCE TECHNOLOGY (BEIJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411128553.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-16
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

In the prior art, the MyBat iS framework needs to be bound to a specific database, which leads to the need to adapt to develop and maintain multiple sets of the same version of code during database migration, which increases the cost of database usage.

Method used

By obtaining the target database connection configuration information, the database metadata management engine and the database driver management engine determine the target database script and driver package, and the driver package is optimized through dynamic SQL converter to realize calls across RDBMS databases, avoiding the adaptation to different databases Provides development and a large number of SQL mapping files modifications.

Benefits of technology

It effectively reduces the cost of database usage, reduces development costs, and realizes smooth switching and efficient calls between different databases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119127168A_ABST
    Figure CN119127168A_ABST
Patent Text Reader

Abstract

The invention discloses a cross-RDBMS database processing method and device, electronic equipment and a medium, and can be widely applied to the technical field of database application. According to the method, after the target database connection configuration information is obtained, the target database script is determined from the to-be-selected database scripts through the database metadata management engine, and the database driver package of the target database script is determined through the database driver management engine; the target driver package is obtained after the database driver package is optimized through the dynamic SQL converter, and then the target database script is operated through the database driver package to call the target database, so that adaptive development does not need to be performed on different databases, SQL mapping files do not need to be modified or do not need to be modified massively, the development cost is effectively reduced, and the development efficiency is improved. And the use cost of the database is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of database application technology, and in particular to a cross-RDBMS database processing method and device, electronic equipment and medium. Background Art

[0002] In the related art, MyBat is, as a popular ORM framework, provides a powerful SQL mapping function, but it needs to be bound to a specific database when used. As a result, when migrating the database, it is necessary to adapt and develop different databases to modify SQL statements, and it is necessary to maintain multiple sets of the same version code. As the number of database environments increases, the cost of using the database also increases.

[0003] In summary, the technical problems existing in the relevant technologies need to be improved. Summary of the invention

[0004] The main purpose of the embodiments of the present application is to propose a cross-RDBMS database processing method and device, electronic device and medium, which can effectively reduce the cost of database use.

[0005] To achieve the above object, an embodiment of the present application provides a cross-RDBMS database processing method, the method comprising the following steps:

[0006] Get the target database connection configuration information;

[0007] According to the target database connection configuration information, determining a target database script from a plurality of database scripts to be selected through a database metadata management engine;

[0008] Determining a database driver package of the target database script through a database driver management engine according to the target database connection configuration information;

[0009] Optimizing the database driver package through a dynamic SQL converter to obtain a target driver package;

[0010] The target database script is run through the target driver package to call the target database.

[0011] In some embodiments, before obtaining the target database connection configuration information, the method further includes the following steps:

[0012] obtaining at least one initial database script and a first database type;

[0013] Performing grammatical analysis on the initial database script to obtain grammatical analysis results;

[0014] A mapping relationship between the initial database script and the first database type is established according to the syntax analysis result.

[0015] In some embodiments, before parsing the initial database script, the method further comprises the following steps:

[0016] Analyzing the compatibility of the SQL field types in the initial database script to obtain a first compatibility analysis result;

[0017] The SQL fields in the initial database script are modified according to the first compatibility analysis result.

[0018] In some embodiments, determining the database driver package of the target database script by a database driver management engine according to the target database connection configuration information includes:

[0019] Identifying a second database type in the target database connection configuration information;

[0020] Acquire multiple driver packages to be selected from the driver package list according to the second database type;

[0021] Performing database server version determination according to the plurality of driver packages to be selected to obtain a version determination result;

[0022] The database driver package is determined from the plurality of driver packages to be selected according to the version determination result.

[0023] In some embodiments, the step of performing database server version determination based on the plurality of driver packages to be selected to obtain a version determination result includes:

[0024] Connecting to a database according to the driver package to be selected;

[0025] When the database connection is successful, obtain several server versions to be matched;

[0026] According to the driver package to be selected, the server version to be matched is version matched in a version matching library to obtain a version matching result as the version judgment result.

[0027] In some embodiments, the dynamic SQL converter includes a local SQL mapper, a built-in SQL converter, and an artificial intelligence converter;

[0028] The local SQL mapper is used to modify the database driver package according to the manually added compatible SQL statement;

[0029] The built-in SQL converter is used to select SQL compatible statements from the built-in SQL compatible library to correct the database driver package;

[0030] The artificial intelligence converter is used to analyze the compatibility impact statements in the database driver package and modify the database driver package according to the compatibility impact statements.

[0031] In some embodiments, the priority of the local SQL mapper is higher than the priority of the built-in SQL converter, and the priority of the built-in SQL converter is higher than the priority of the artificial intelligence converter.

[0032] To achieve the above object, another aspect of an embodiment of the present application provides a cross-RDBMS database processing device, the device comprising:

[0033] The first module is used to obtain the target database connection configuration information;

[0034] The second module is used to determine the target database script from multiple database scripts to be selected through a database metadata management engine according to the target database connection configuration information;

[0035] The third module is used to determine the database driver package of the target database script through the database driver management engine according to the target database connection configuration information;

[0036] The fourth module is used to optimize the database driver package through a dynamic SQL converter to obtain a target driver package;

[0037] The fifth module is used to run the target database script through the target driver package to call the target database.

[0038] To achieve the above object, another aspect of an embodiment of the present application provides an electronic device, including:

[0039] at least one processor;

[0040] at least one memory for storing at least one program;

[0041] When the at least one program is executed by the at least one processor, the at least one processor implements the above method.

[0042] To achieve the above objective, another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program implements the above method when executed by a processor.

[0043] The embodiments of the present application include at least the following beneficial effects: The present application provides a cross-RDBMS database processing method and device, electronic device and medium. After obtaining the target database connection configuration information, the solution determines the target database script from multiple database scripts to be selected through the database metadata management engine, determines the database driver package of the target database script through the database driver management engine, and optimizes the database driver package through the dynamic SQL converter to obtain the target driver package, and then runs the target database script through the target driver package to call the target database, thereby eliminating the need for adaptation development of different databases, and eliminating the need to modify or modify a large number of SQL mapping files, effectively reducing development costs, and thus reducing database usage costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 It is a flowchart of a cross-RDBMS database processing method provided by an embodiment of the present application;

[0045] Figure 2 is a flowchart of another cross-RDBMS database processing method provided in an embodiment of the present application;

[0046] Figure 3 is a processing flow chart of a database metadata management engine provided in an embodiment of the present application;

[0047] Figure 4 yes Figure 1 Flow chart of step S130 in FIG.

[0048] Figure 5 yes Figure 4 Flow chart of step S430 in FIG.

[0049] Figure 6 is an overall flow chart of the database driven management engine provided by the embodiment of the present application;

[0050] Figure 7 It is a module schematic diagram of the dynamic SQL converter provided in the embodiment of the present application;

[0051] Figure 8 is an application flow chart of the dynamic SQL converter provided in the embodiment of the present application;

[0052] Fig. 9 It is a schematic diagram of the structure of a cross-RDBMS database processing device provided in an embodiment of the present application;

[0053] Fig.10 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION

[0054] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application, they are only examples of devices and methods consistent with some aspects of the embodiments of the present application.

[0055] It is understood that the terms "first", "second", etc. used in this application can be used to describe various concepts in this article, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another concept. For example, without departing from the scope of the embodiment of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein can be interpreted as "at the time of" or "when" or "in response to determination".

[0056] The terms "at least one", "multiple", "each", "any", etc. used in this application, at least one includes one, two or more, multiple includes two or more, each refers to each of the corresponding multiple, and any refers to any one of the multiple.

[0057] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0058] Before describing the embodiments of the present application in detail, some nouns and terms involved in the embodiments of the present application are first described. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations:

[0059] A database can be considered as an electronic filing cabinet for storing electronic files. The target object can add, intercept, update, delete, and other operations on the data in the file. A database is a collection of data that is stored together in a certain way, can be shared by multiple target objects, has as little redundancy as possible, and is independent of the application program. A database consists of multiple table spaces.

[0060] Mybatis is a persistence layer framework that supports common SQL queries, stored procedures, and advanced mapping. Mybatis eliminates almost all manual settings of JDBC codes and parameters and retrieval of result sets, uses simple XML or annotations for configuration and primitive mapping, and maps interfaces and Java POJOs (Plain Ordinary Java Objects) into records in the database.

[0061] RDBMS is a relational database management system, which includes a collection of interconnected data (database) and a set of programs for accessing this data (database management system software). A relational database management system is a system that manages relational databases and organizes data into related rows and columns.

[0062] MySQL is a relational database management system. The SQL language it uses is the most commonly used standard language for accessing databases. Due to its small size, fast speed, and open source, MySQL is generally chosen as the website database for the development of small and medium-sized websites.

[0063] Structured Query Language (SQL) is a special-purpose programming language, as well as a database query and programming language used to access data and query, update, and manage relational database systems; it is also the extension of database script files. SQL is a high-level non-procedural programming language that allows users to work on high-level data structures. It does not require the target object to specify the storage method for data, nor does it require the target object to understand the specific data storage method, so different database systems with completely different underlying structures can use the same SQL as the interface for data input and management. SQL statements can be nested, giving it great flexibility and powerful functions.

[0064] DM is a database management system used to manage and organize data, and provides functions such as database access, storage, query and update.

[0065] ORM refers to object-relational mapping, which provides a conceptual and easy-to-understand method for modeling data. ORM was born with the development of object-oriented software development methods. Object-oriented development methods are the mainstream development methods in today's enterprise-level application development environments, and relational databases are the mainstream data storage systems for permanent data storage in enterprise-level application environments. Objects and relational data are two forms of business entities. Business entities are represented as objects in memory and as relational data in databases. There are associations and inheritance relationships between objects in memory, while in databases, relational data cannot directly express many-to-many associations and inheritance relationships. Therefore, object-relational mapping (ORM) generally exists in the form of middleware, mainly to achieve the mapping of program objects to relational database data.

[0066] Artificial Intelligence (AI) is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence. AI is a branch of computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can respond in a similar way to human intelligence. Research in this field includes robots, language recognition, image recognition, natural language processing and expert systems. AI can simulate the information process of human consciousness and thinking. AI is also a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0067] Natural language processing (NLP): NLP uses computers to process, understand and apply human languages ​​(such as Chinese and English). NLP is a branch of artificial intelligence and an interdisciplinary subject between computer science and linguistics. It is often referred to as computational linguistics. Natural language processing includes grammatical analysis, semantic analysis, and text understanding. Natural language processing is often used in technical fields such as machine translation, handwritten and printed character recognition, speech recognition and text-to-speech conversion, information intent recognition, information extraction and filtering, text classification and clustering, public opinion analysis and opinion mining. It involves data mining related to language processing, machine learning, knowledge acquisition, knowledge engineering, artificial intelligence research, and linguistic research related to language computing.

[0068] Information Extraction: A text processing technology that extracts specified types of entity, relationship, event and other factual information from natural language text and forms structured data output. Information extraction is a technology that extracts specific information from text data. Text data is composed of some specific units, such as sentences, paragraphs, and chapters. Text information is composed of some small specific units, such as characters, words, phrases, sentences, paragraphs, or a combination of these specific units. Extracting noun phrases, names, place names, etc. from text data are all text information extraction. Of course, the information extracted by text information extraction technology can be various types of information.

[0069] Metadata is information that describes data properties and is used to support functions such as indicating storage location, historical data, resource search, and file records. Specifically, metadata is data about the data warehouse, and refers to key data related to data source definition, target definition, conversion rules, etc. generated during the construction of the data warehouse.

[0070] Database dialect refers to the syntax unique to each database, such as MySQL's list and Oracle's rownumber. These unique syntaxes are called database dialects.

[0071] The database engine is the core service for storing, processing, and protecting data. The database engine allows you to control access permissions and process transactions quickly, meeting the requirements of most applications within the enterprise that need to process large amounts of data. The database engine allows you to create a relational database for online transaction processing or connected analytical processing data.

[0072] With the development of information technology, enterprise applications need to frequently deal with the standards of different database environments, such as switching from MySQL to database DM. In related technologies, MyBat is, as a popular ORM framework, provides powerful SQL mapping functions, but it needs to be bound to a specific database when used. As a result, when migrating databases, it is necessary to adapt and develop different databases to modify SQL statements, and it is necessary to maintain multiple sets of the same version code. As the number of database environments increases, the cost of using the database also increases.

[0073] In view of this, the embodiments of the present application provide a cross-RDBMS database processing method and device, electronic device and medium. After obtaining the target database connection configuration information, the present application uses the database metadata management engine, the database driver management engine and the dynamic SQL converter to determine the target database script and the database driver package, and then runs the target database script through the database driver package to call the target database, thereby eliminating the need for adaptation development of different databases, effectively reducing development costs, and further reducing database usage costs.

[0074] The processing method across RDBMS databases provided in the embodiment of the present application relates to the field of database application technology. The processing method across RDBMS databases provided in the embodiment of the present application can be applied to a terminal, can also be applied to a server, and can also be software running in a terminal or a server. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, and a car terminal, etc., but is not limited to this; the server side can be configured as an independent physical server, or it can be configured as a server cluster or distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server can also be a node server in a blockchain network; the software can be an application that implements the processing method across RDBMS databases, etc., but is not limited to the above forms.

[0075] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0076] Figure 1 is an optional flowchart of the cross-RDBMS database processing method provided in the embodiment of the present application. Figure 1 The method may include but is not limited to steps S101 to S106.

[0077] Step S110, obtaining target database connection configuration information;

[0078] Step S120: determining a target database script from a plurality of database scripts to be selected through a database metadata management engine according to the target database connection configuration information;

[0079] Step S130: Determine the database driver package of the target database script through the database driver management engine according to the target database connection configuration information;

[0080] Step S140, optimizing the database driver package through a dynamic SQL converter to obtain a target driver package;

[0081] Step S150: Run the target database script through the target driver package to call the target database.

[0082] It is understandable that the method of this embodiment is based on the Mybatis framework to call the database, and specifically can use the SQL mapping function of the Mybatis framework to implement the call of databases between different relational database management systems (RDBMS). Exemplarily, when an enterprise needs to call database A1 in a relational database management system, it can be based on the database A1 connection configuration information and use the Mybatis framework to implement the call process of database A1.

[0083] Since the Mybatis framework in the prior art implements the database calling process by binding with a specific database, it is necessary to re-bind the database when migrating the database, which greatly increases the development workload. Therefore, this embodiment implements the calling of different databases by setting three modules: a database metadata management engine, a database driver management engine, and a dynamic SQL converter, so that there is no need to bind the data set, effectively reducing the development workload of the database calling process.

[0084] In the embodiments of the present application, Figure 2 As shown, before obtaining the target database connection configuration information, Figure 1 The method shown also includes but is not limited to steps S210 to S230:

[0085] Step S210, obtaining at least one initial database script and a first database type;

[0086] Step S220, performing syntax analysis on the initial database script to obtain a syntax analysis result;

[0087] Step S230: Establish a mapping relationship between the initial database script and the first database type according to the syntax analysis result.

[0088] It is understandable that the processing of the present embodiment can be executed in a database metadata management engine. Wherein, the initial database script refers to the running script corresponding to the database that can be called by the Mybatis framework. The first database type is the database type that is called by the Mybatis framework. Since the initial database script currently obtained is not necessarily completely corresponding to the first database type, the present embodiment can establish a mapping relationship between the initial database script and the first database type based on the grammatical analysis result after the initial database script obtained is parsed. In the present embodiment, the grammatical analysis process of the initial database script can use a natural language processing model to extract information, and the information such as entities and relationships extracted from the information is composed of structured data, and then the relationship between the initial database script and the first database type is analyzed based on the structured data, and when the initial database script corresponds to the first database type, the association relationship (mapping relationship) between the initial database script and the first database type is established.

[0089] In the embodiment of the present application, before the syntax analysis of the initial database script is performed, the embodiment also needs to analyze the compatibility of the SQL field type in the initial database script to obtain a first compatibility analysis result, and the SQL field in the initial database script is corrected according to the first compatibility analysis result. Exemplarily, if the SQL field type corresponding to the initial database script B1 is incompatible with the SQL field type corresponding to the database to be called, the SQL field in the initial database script B1 needs to be corrected so that the corresponding database can be called when the initial database script is running.

[0090] It is understood that the process of syntax analysis includes but is not limited to semantic analysis and keyword extraction of the initial database script. Semantic analysis can be performed by analyzing the language elements and syntactic elements of the content contained in the initial database script to reveal the meanings expressed by words and sentences. Keyword extraction can be performed by extracting keywords that can express specific meanings in the initial database script, so that the database corresponding to the initial database script can be analyzed based on the extracted keywords.

[0091] In the embodiment of the present application, the database metadata management engine can be encapsulated based on the characteristics and differences of different databases, so that the script of the corresponding database can be directly called during the application process. Figure 3As shown, the multiple copies of the initial database scripts obtained are input into the database metadata management engine, and the multiple database types obtained are input into the database metadata management engine at the same time, so as to perform syntax analysis on the initial database scripts in the database metadata management engine, and infer the incompatible SQL field types based on the syntax analysis results to obtain compatible SQL fields, and then correct the SQL fields in the initial database scripts, thereby completing the management and initialization process of different versions of database scripts, which can effectively improve the efficiency of subsequent database calls.

[0092] In an embodiment of the present application, after completing the processing of the database metadata engine, when the target database connection configuration information is received, the target database script can be determined from multiple database scripts to be selected through the database metadata engine based on the target database connection configuration information, so that the target database script can run the corresponding database, effectively improving the database calling efficiency.

[0093] In the embodiment of the present application, the database driver management engine includes a set of database driver management tools, which can automatically identify the database type according to the configured database connection information and load the driver package and dialect strategy of the corresponding version database. Figure 4 As shown, the process of determining the database driver package of the target database script by the database driver management engine according to the target database connection configuration information includes but is not limited to steps S410 to S440:

[0094] Step S410, identifying the second database type in the target database connection configuration information;

[0095] Step S420: acquiring a plurality of driver packages to be selected from the driver package list according to the second database type;

[0096] Step S430, performing database server version determination according to multiple driver packages to be selected to obtain a version determination result;

[0097] Step S440: Determine the database driver package from multiple driver packages to be selected according to the version determination result.

[0098] It is understandable that the target database connection configuration information is used to guide the MyBat is framework to run the corresponding RDBMS to call the target database. For example, when an enterprise wants to run database C1, the target object (technician) in the enterprise can enter the target database connection configuration information in the human-computer interaction interface in the preset software, and the MyBat is framework can run the corresponding RDBMS to call database C1 to perform work.

[0099] In an embodiment of the present application, the database driver management engine can call several database driver packages, which are set in the driver package list. After receiving the target database connection configuration information, the database type currently required to be called is identified from the target database connection configuration information as the second database type, and then multiple database driver packages corresponding to the database type are obtained from the driver package list as the driver packages to be selected, and then the database server version corresponding to the driver package to be selected is obtained, and the obtained database server version is matched with the database server version in the pre-set version matching library, and the driver package to be selected with the successful version matching is used as the database driver package.

[0100] In the embodiments of the present application, Figure 5 As shown, the process of performing database server version determination according to multiple driver packages to be selected to obtain a version determination result includes but is not limited to steps S510 to S530:

[0101] Step S510, connecting to a database according to the driver package to be selected;

[0102] Step S520: when the database connection is successful, obtain several server versions to be matched;

[0103] Step S530: According to the driver package to be selected, the server version to be matched is matched in the version matching library to obtain a version matching result as a version judgment result.

[0104] It can be understood that after obtaining the driver package to be selected, a database connection is performed based on the driver package to be selected. Since the current driver package to be selected may be able to drive the RDBMS to connect to multiple databases, this embodiment also needs to determine the version of each database server after the RDBMS driven by the driver package to be selected successfully connects to the database. Only when the database server version is also successfully matched, the corresponding driver package to be selected is used as the database driver package, thereby improving the working stability of the subsequent database call process.

[0105] For example, Figure 6 As shown, the overall process of the database-driven management engine includes but is not limited to:

[0106] Step S610, obtaining database connection configuration information;

[0107] Step S620: Identify the corresponding database type according to the database connection configuration information;

[0108] Step S630, obtaining all driver packages corresponding to the database type as driver packages to be selected;

[0109] Step S640, try to connect each driver package to be selected to the RDBMS and the corresponding database. If the connection fails, execute step S630; if the connection is successful, execute step S650;

[0110] Step S650, obtaining the database server version corresponding to the successfully connected driver package to be selected;

[0111] Step S660, matching the database server version with the database server version in the preset version matching library, if all database server versions fail to match, executing step 630; otherwise, the successfully matched driver package to be selected is used as the current database driver package.

[0112] Exemplarily, after the corresponding database type is identified according to the database connection configuration information, it is determined that the database type corresponds to three driver packages to be selected, namely, driver package D1, driver package D2 and driver package D3. In this embodiment, the connection between the RDBMS and the corresponding database is first attempted by driver package D1. If the connection is successful, the database server version corresponding to the database is obtained, and the database server version is matched with the database server version in the preset version matching library. If the match is successful, the driver package D1 corresponding to the database server version is used as the database driver package. In this embodiment, if the connection between the RDBMS and the corresponding database based on driver package D1 fails or the database server version matching fails, driver package D2 is obtained as the driver package to be selected, and then the process executed by the above driver package D1 is executed; if the connection between the RDBMS and the corresponding database based on driver package D2 fails or the database server version matching fails, driver package D3 is obtained as the driver package to be selected, and then the process executed by the above driver package D1 is executed. In this embodiment, if the connection or version matching of all driver packages fails, an error prompt message is generated, and the error prompt message is sent to the corresponding human-computer interaction interface for display.

[0113] In the embodiment of the present application, after obtaining the database driver package, the database driver package can be optimized by a dynamic SQL converter so that the database driver package can effectively and accurately run the target database script to call the target database. It is understandable that if Figure 7 As shown, the dynamic SQL converter includes a local SQL mapper 710, a built-in SQL converter 720 and an artificial intelligence converter 730. The local SQL mapper is used to modify the database driver package according to the manually added compatible SQL statements; the built-in SQL converter is used to select SQL compatible statements from the built-in SQL compatible library to modify the database driver package; the artificial intelligence converter is used to analyze the compatible affecting statements in the database driver package and modify the database driver package according to the compatible affecting statements.

[0114] In this embodiment, the priority of the local SQL mapper is higher than that of the built-in SQL converter, and the priority of the built-in SQL converter is higher than that of the artificial intelligence converter. Therefore, in this embodiment, after the database driver package, the incompatible SQL statements in the database driver package are first corrected by the local SQL mapper, and specifically, compatible SQL statements can be added to the database driver package by manual compensation based on feature rules. In this embodiment, the SQL statements in the database driver package can also be corrected by extracting SQL compatible statements from the built-in SQL compatible library through the built-in SQL converter. If the local SQL mapper and the built-in SQL converter cannot effectively process the incompatible statements in the database driver package, the artificial intelligence converter can also analyze and process the SQL statements in the database driver package, and determine the part of the database driver package that may affect the cross-database compatibility based on the analysis results, and then automatically correct the part or give optimization suggestions, so that the enterprise technicians can quickly process the SQL statements in the database driver package according to the optimization suggestions for correction.

[0115] In the embodiments of the present application, Figure 8 As shown, the dynamic SQL converter includes but is not limited to the following during application:

[0116] Step S810, determine that the database call project is started;

[0117] Step S820, reading the database connection configuration information corresponding to the project;

[0118] Step S830: Identify the type of database currently required to be called according to the database connection configuration information;

[0119] Step S840: Determine a database driver package corresponding to the database type from a database driver library based on a database driver management engine;

[0120] Step S850: Correct the incompatible SQL statements in the database driver package through the local SQL mapper;

[0121] Step S860: Correct the incompatible SQL statements in the database driver package through the built-in SQL converter;

[0122] Step S870, correcting the incompatible SQL statements in the database driver package through the artificial intelligence converter;

[0123] Step S880, identifying and determining that the incompatible SQL statements in the database driver package have been corrected;

[0124] Step S890: Load the compatible SQL statement into the database driver package.

[0125] This embodiment corrects the incompatible SQL statements in the database driver package and corrects the database script through the database metadata management engine, so that the SQL statements in the database driver package can effectively run the target database script, thereby effectively and accurately calling the target database.

[0126] It can be seen that after the method provided in the embodiment of the present application is made into a plug-in, during the application process, after the plug-in is loaded into the preset software, the target object only needs to configure the target database connection configuration information in the application.properties, and the plug-in can automatically identify the target database type and the corresponding target database script, load the corresponding version of the database driver package, and identify incompatible SQL and convert it during the database startup phase. There is no need to modify or modify a large number of SQL mapping files, so as to achieve smooth switching between different types of databases, effectively reduce development costs, and thus reduce database usage costs.

[0127] Reference Fig. 9 , an embodiment of the present application provides a cross-RDBMS database processing device, the device comprising:

[0128] The first module 910 is used to obtain target database connection configuration information;

[0129] The second module 920 is used to determine the target database script from multiple database scripts to be selected through the database metadata management engine according to the target database connection configuration information;

[0130] The third module 930 is used to determine the database driver package of the target database script through the database driver management engine according to the target database connection configuration information;

[0131] The fourth module 940 is used to optimize the database driver package through a dynamic SQL converter to obtain a target driver package;

[0132] The fifth module 950 is used to run the target database script through the target driver package to call the target database.

[0133] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0134] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above-mentioned cross-RDBMS database processing method when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.

[0135] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0136] See also Fig.10 , Fig.10 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:

[0137] The processor 1010 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;

[0138] The memory 1020 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1020 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 1020, and the processor 1010 calls and executes the cross-RDBMS database processing method of the embodiment of this application;

[0139] Input / output interface 1030, used to implement information input and output;

[0140] The communication interface 1040 is used to realize the communication interaction between the device and other devices. The communication can be realized through a wired manner (such as USB, network cable, etc.) or a wireless manner (such as mobile network, WI FI, Bluetooth, etc.);

[0141] Bus 1050 , which transmits information between various components of the device (e.g., processor 1010 , memory 1020 , input / output interface 1030 , and communication interface 1040 );

[0142] The processor 1010 , the memory 1020 , the input / output interface 1030 , and the communication interface 1040 are connected to each other in communication within the device via a bus 1050 .

[0143] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned cross-RDBMS database processing method is implemented.

[0144] It can be understood that the contents of the above method embodiments are all applicable to the present storage medium embodiments, the functions specifically implemented by the present storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0145] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0146] The cross-RDBMS database processing method and device, electronic device and medium provided by the embodiments of the present application determine the target database script from multiple database scripts to be selected through a database metadata management engine based on the target database connection configuration information; and determine the database driver package of the target database script through a database driver management engine based on the target database connection configuration information, and optimize the database driver package through a dynamic SQL converter to obtain a target driver package, and then run the target database script through the database driver package to call the target database, thereby eliminating the need for adaptation development of different databases and the need to modify or modify a large number of SQL mapping files, effectively reducing development costs and thereby reducing database usage costs.

[0147] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0148] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.

[0149] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0150] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.

[0151] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0152] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0153] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0154] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0155] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0156] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or 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 multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.

[0157] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.

Claims

1. A cross-RDBMS database processing method, characterized in that: The method comprises the following steps: Get the target database connection configuration information; According to the target database connection configuration information, determining a target database script from a plurality of database scripts to be selected through a database metadata management engine; Determining a database driver package of the target database script through a database driver management engine according to the target database connection configuration information; Optimizing the database driver package through a dynamic SQL converter to obtain a target driver package; The target database script is run through the target driver package to call the target database.

2. The method according to claim 1, characterized in that Before obtaining the target database connection configuration information, the method further includes the following steps: obtaining at least one initial database script and a first database type; Performing grammatical analysis on the initial database script to obtain grammatical analysis results; A mapping relationship between the initial database script and the first database type is established according to the syntax analysis result.

3. The method according to claim 2, characterized in that Before the syntax analysis of the initial database script, the method further comprises the following steps: Analyzing the compatibility of the SQL field types in the initial database script to obtain a first compatibility analysis result; The SQL fields in the initial database script are modified according to the first compatibility analysis result.

4. The method according to claim 1, characterized in that: The step of determining the database driver package of the target database script by a database driver management engine according to the target database connection configuration information includes: Identifying a second database type in the target database connection configuration information; Acquire multiple driver packages to be selected from the driver package list according to the second database type; Determine the version of the database server according to the plurality of driver packages to be selected, and obtain a version determination result; The database driver package is determined from the plurality of driver packages to be selected according to the version determination result.

5. The method according to claim 4, characterized in that The step of performing database server version determination according to the plurality of driver packages to be selected to obtain a version determination result includes: Connecting to a database according to the driver package to be selected; When the database connection is successful, obtain several server versions to be matched; According to the driver package to be selected, the server version to be matched is version matched in a version matching library to obtain a version matching result as the version judgment result.

6. The method according to claim 1, characterized in that The dynamic SQL converter includes a local SQL mapper, a built-in SQL converter and an artificial intelligence converter; The local SQL mapper is used to modify the database driver package according to the manually added compatible SQL statement; The built-in SQL converter is used to select SQL compatible statements from the built-in SQL compatible library to correct the database driver package; The artificial intelligence converter is used to analyze the compatibility impact statements in the database driver package and modify the database driver package according to the compatibility impact statements.

7. The method according to claim 6, characterized in that The priority of the local SQL mapper is higher than that of the built-in SQL converter, and the priority of the built-in SQL converter is higher than that of the artificial intelligence converter.

8. A cross-RDBMS database processing device, characterized in that: The device comprises: The first module is used to obtain the target database connection configuration information; The second module is used to determine the target database script from multiple database scripts to be selected through a database metadata management engine according to the target database connection configuration information; The third module is used to determine the database driver package of the target database script through the database driver management engine according to the target database connection configuration information; The fourth module is used to optimize the database driver package through a dynamic SQL converter to obtain a target driver package; The fifth module is used to run the target database script through the target driver package to call the target database.

9. An electronic device, characterized in that: include: at least one processor; at least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the method according to any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.