Heterogeneous database mapping table establishing method, device and equipment and storage medium

By determining and using Java database connection standard types of table field type mapping relationships, automatic mapping and automatic table creation between heterogeneous databases are realized, which solves the problem of high complexity in creating heterogeneous database models and improves the efficiency of data migration and synchronization. efficiency and stability.

CN119336732APending Publication Date: 2025-01-21SHANGHAI INSPUR CLOUD COMPUTING SERVICE CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411540832.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

During the processing of big data platform, model creation and data migration between heterogeneous databases are time-consuming and error-prone, especially how to achieve high-speed and stable data migration and synchronization between heterogeneous data sources in complex network environments. .

Method used

By determining the table field type mapping relationship between the first database, the second database and the Java database connection standard type, obtaining and mapping table field types, generating a table-building structured query language, creating a target table based on the language, and realizing a heterogeneous database Automatic mapping between automatic mapping and automatic table creation.

Benefits of technology

The complexity of the heterogeneous database model is reduced, the efficiency is improved, the automatic mapping and automatic tables between the heterogeneous database are realized, and the speed and stability of data migration and synchronization are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119336732A_ABST
    Figure CN119336732A_ABST
Patent Text Reader

Abstract

The invention discloses a heterogeneous database mapping table building method and device, equipment and a storage medium, and relates to the technical field of database migration, and the method comprises the following steps: determining a table field type mapping relationship between a first database and a Java database connection standard type as well as between a second database and the Java database connection standard type; obtaining a first database table field type of the first database, and mapping the first database table field type into a Java database connection standard type according to the table field type mapping relationship; mapping the Java database connection standard type to a second database table field type corresponding to a second database based on the table field type mapping relationship, and obtaining a corresponding mapped database table field type; generating a table building structured query language according to the mapped database table field type, and building a target table corresponding to the second database based on the table building structured query language. Therefore, automatic mapping and automatic table establishment between heterogeneous databases can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of database migration, and in particular to a heterogeneous database mapping table building method, device, equipment and storage medium. Background Art

[0002] With the rapid development of modern information technology, the world has entered the era of Internet + big data. The rapid progress of artificial intelligence technology is also the result of the rapid development of big data in recent years. Information is profoundly changing people's thinking, production and lifestyle. More and more industries are beginning to pay attention to data and use data to empower their businesses. In recent years, various enterprise data governance application platforms have rapidly emerged and developed, providing one-stop services for data governance. In the process of big data platform processing, how to provide high-speed and stable data migration between rich heterogeneous data sources in a complex network environment and data synchronization under complex business backgrounds has become an indispensable capability. In the process of data modeling, there are often model creation and data migration between heterogeneous databases. First, the association modeling between heterogeneous databases must be carried out. However, the database types and syntax between different databases are different. The traditional operation is to manually map through tools, which is very time-consuming and error-prone.

[0003] Therefore, how to automatically map and create tables between heterogeneous databases, reduce the complexity of creating heterogeneous database models, and improve efficiency is an urgent problem to be solved. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a heterogeneous database mapping table building method, device, equipment and storage medium, which can automatically map and automatically build tables between heterogeneous databases, reduce the complexity of heterogeneous database model creation, and improve efficiency. The specific scheme is as follows:

[0005] In a first aspect, the present application discloses a heterogeneous database mapping table building method, comprising:

[0006] Determine a table field type mapping relationship between the first database and the second database and a Java database connection standard type;

[0007] Acquire a first database table field type of the first database, and map the first database table field type to the Java database connection standard type according to the table field type mapping relationship;

[0008] Mapping the Java database connection standard type to a second database table field type corresponding to the second database based on the table field type mapping relationship, and obtaining a corresponding mapped database table field type;

[0009] A table creation structured query language is generated according to the mapped database table field type, and a target table corresponding to the second database is created based on the table creation structured query language.

[0010] Optionally, determining a table field type mapping relationship between the first database and the second database and a Java database connection standard type includes:

[0011] Determine table field types corresponding to the first database and the second database respectively;

[0012] Create a data type mapping file based on the table field type and the Java database connection standard type;

[0013] The data type mapping file is read to obtain a table field type mapping relationship between the first database and the second database and the Java database connection standard type.

[0014] Optionally, the obtaining the first database table field type of the first database includes:

[0015] Metadata corresponding to a first database table is extracted from the first database, and a field type of the first database table is acquired based on the metadata.

[0016] Optionally, extracting metadata corresponding to the first database table from the first database includes:

[0017] The metadata corresponding to the first database table is extracted from the first database by executing a metadata structured query language or using an application programming interface of the first database.

[0018] Optionally, the metadata includes table name, field name, field type, primary key and foreign key.

[0019] Optionally, after generating the table building structured query language according to the mapped database table field type, the method further includes:

[0020] constructing a target structured query language according to the metadata and the type attributes of the second database;

[0021] The target structured query language is executed to create indexes, foreign keys, and attributes of the target table.

[0022] Optionally, after creating the target table corresponding to the second database based on the table creation structured query language, the method further includes:

[0023] The table building process and corresponding logic corresponding to the target table are encapsulated using code to construct an automatic table building tool, so as to create the target table corresponding to the second database based on the automatic table building tool and the table information corresponding to the first database.

[0024] In a second aspect, the present application discloses a heterogeneous database mapping table building device, comprising:

[0025] A mapping relationship determination module, used to determine the table field type mapping relationship between the first database and the second database and the Java database connection standard type;

[0026] A first mapping module, used for acquiring a first database table field type of the first database, and mapping the first database table field type to the Java database connection standard type according to the table field type mapping relationship;

[0027] A second mapping module is used to map the Java database connection standard type to a second database table field type corresponding to the second database based on the table field type mapping relationship, and obtain the corresponding mapped database table field type;

[0028] A table creation module is used to generate a table creation structured query language according to the mapped database table field type, and create a target table corresponding to the second database based on the table creation structured query language.

[0029] In a third aspect, the present application discloses an electronic device, comprising:

[0030] Memory, used to store computer programs;

[0031] The processor is used to execute the computer program to implement the heterogeneous database mapping table building method as described above.

[0032] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the heterogeneous database mapping table creation method as described above.

[0033] The present application first determines the table field type mapping relationship between the first database and the second database and the Java database connection standard type; then obtains the first database table field type of the first database, and maps the first database table field type to the Java database connection standard type according to the table field type mapping relationship; then maps the Java database connection standard type to the second database table field type corresponding to the second database based on the table field type mapping relationship, and obtains the corresponding mapped database table field type; finally generates a table building structured query language based on the mapped database table field type, and creates a target table corresponding to the second database based on the table building structured query language. It can be seen that the present application determines the mapping relationship between different types of database table field types and Java database connection standard types; obtains the table structure of the original table: the fields in the table and the data types of each field, and then maps the original table structure to the Java database connection standard type according to the mapping relationship; maps the Java database connection standard type to a specific database table field type according to the target table type and the mapping relationship, generates the corresponding target table structured query language according to the mapped table structure, and finally executes the structured query language to automatically build a table. In this way, based on Java database connection, automatic mapping of table models between heterogeneous databases and automatic table creation are performed, reducing the complexity of creating heterogeneous database models and improving efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0035] Figure 1 A flowchart of a heterogeneous database mapping table building method disclosed in this application;

[0036] Figure 2 A schematic diagram of the contents of a mapping file disclosed in this application;

[0037] Figure 3 A schematic diagram of the contents of a mapping file disclosed in this application;

[0038] Figure 4 A schematic diagram of a table structure disclosed in this application;

[0039] Figure 5 A schematic diagram of the structure of a heterogeneous database mapping and table building device disclosed in this application;

[0040] Figure 6This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0041] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only 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.

[0042] Traditional data modeling systems usually adopt the following mapping strategies for mapping field types of heterogeneous databases: determine the source database table structure, clarify the data table, fields in the table and the data type of each field, and generate SQL (Structured Query Language) statements; manually modify the SQL statements according to the target database table type and the corresponding syntax, thereby generating SQL statements for the target database table, and then build the table through a third-party tool. This strategy has the following disadvantages: when the number of source database table fields is large, the workload of modifying SQL statements according to the target database table type and the corresponding syntax is huge and the efficiency is extremely low; different types of source databases and target databases have different syntaxes, and the table field mapping rules are also different, resulting in poor scalability. In order to solve the above technical problems, the present application discloses a heterogeneous database mapping table building method, which can perform automatic mapping and automatic table building between heterogeneous databases, reduce the complexity of heterogeneous database model creation, and improve efficiency.

[0043] See also Figure 1 As shown, an embodiment of the present invention discloses a heterogeneous database mapping table building method, including:

[0044] Step S11: determining a table field type mapping relationship between the first database and the second database and a Java database connection standard type.

[0045] In this embodiment, when determining the table field type mapping relationship between the first database and the second database and the Java database connection standard type, first determine the table field types corresponding to the first database and the second database respectively; create a data type mapping file based on the table field type and the Java database connection standard type; read the data type mapping file to obtain the table field type mapping relationship between the first database and the second database and the Java database connection standard type. Taking the migration of the mysql database to the postgresql database as an example, first create a matrix of data type mapping rules, listing each data type in the source database and its corresponding type in the target database.

[0046] Java database connection standard types include: BIT, TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, REAL, DOUBLE, NUMERIC, CHAR, VARCHAR, LONGVARCHAR, CLOB, BLOB, etc.

[0047] Common field types in MySQL database include: VARCHAR, CHAR, DATE, DATETIME, TIME, TIMESTAMP, INT, INTEGER, DOUBLE, FLOAT, TEXT, BIT, TINYINT, SMALLINT, etc.

[0048] Common field types of postgresql database include: VARCHAR2, CHAR, DATE, TIMESTAMP, NUMBER, BLOB, CLOB, LONG, etc.

[0049] The source database Mysql table field types are mapped to Java database connection standard types as shown in Table 1:

[0050] Table 1

[0051]

[0052] The mapping of Java database connection standard types to the target database Oracle table field types is shown in Table 2 below:

[0053] Table 2

[0054]

[0055] The above mapping relationship is obtained by reading the mapping file. The mapping file uses the json format and the content is as follows Figure 2 and Figure 3 shown.

[0056] Step S12: obtaining a first database table field type of the first database, and mapping the first database table field type to the Java database connection standard type according to the table field type mapping relationship.

[0057] In this embodiment, it is necessary to extract the metadata of the table structure from the source database, including information such as table name, field name, field type, primary key, foreign key, etc. This can be done by executing SQL queries or using the database API (Application Programming Interface). For example, in MySQL, the following SQL statement can be used to obtain the metadata of the table:

[0058] Example Sql:

[0059] SELECT column_name, data_type, is_nullable, column_key

[0060] FROM information_schema.columns

[0061] WHERE table_schema = 'your_database' AND table_name = 'your_table';

[0062] In this example, the original table tt_info is used. The table structure is as follows Figure 4 According to the mapping relationship in step S11 (the source database Mysql is mapped to the Java database connection standard type), the fields and their type mapping results shown in the following Table 3 can be obtained:

[0063] Table 3

[0064]

[0065] That is, the first database table field type is mapped to a Java database connection standard type according to the table field type mapping relationship.

[0066] Step S13: Map the Java database connection standard type to a second database table field type corresponding to the second database based on the table field type mapping relationship, and obtain the corresponding mapped database table field type.

[0067] In this embodiment, the Java database connection standard type is mapped to the second database table field type corresponding to the second database based on the table field type mapping relationship. Specifically, according to the mapping relationship in step S11 (standard type is mapped to the target database Mysql), the fields and types of the target database table shown in Table 4 can be obtained:

[0068] Table 4

[0069]

[0070] Step S14: Generate a table creation structured query language according to the mapped database table field type, and create a target table corresponding to the second database based on the table creation structured query language.

[0071] In this embodiment, a table building structured query language is generated according to the type of the database table field after mapping, and after the table building structured query language is generated according to the type of the database table field after mapping, it also includes: constructing a target structured query language according to the metadata and the type of the second database; executing the target structured query language to create an index, foreign key and attribute of the target table. It should be noted that when processing fields such as primary keys, foreign keys, and indexes, since each database has different characteristics and its own dialect, it is necessary to map and create primary keys, foreign keys, indexes and other attributes in a manner supported by the database.

[0072] Take MySQL to create an index as an example:

[0073] CREATE INDEX index_name ON table_name(column1, column2, ...);

[0074] where index_name is the name of the index you want to create, table_name is the name of the table, and column1, column2, ... are the columns you want to index.

[0075] For different databases, you need to create indexes, foreign keys and other attributes in the way supported by the database.

[0076] Then, the target structured query language is executed to create the index, foreign key and attributes of the target table, and the SQL statement is executed in the target database to automatically create the table.

[0077] In addition, the table building process corresponding to the target table and the corresponding logic can be encapsulated using code to build an automatic table building tool, so as to create the target table corresponding to the second database based on the automatic table building tool and the table information corresponding to the first database. That is, the above table building process and logic are encapsulated using code. Because the present invention fully complies with the JDBC (JavaDataBase Connectivity, Java database connection) open source protocol, there is no restriction on the development language, and it supports various languages ​​that implement the JDBC open source protocol. It can directly connect to various systems and has high compatibility.

[0078] In summary, the present application first determines the table field type mapping relationship between the first database and the second database and the Java database connection standard type; then obtains the first database table field type of the first database, and maps the first database table field type to the Java database connection standard type according to the table field type mapping relationship; then maps the Java database connection standard type to the second database table field type corresponding to the second database based on the table field type mapping relationship, and obtains the corresponding mapped database table field type; finally generates a table building structured query language based on the mapped database table field type, and creates a target table corresponding to the second database based on the table building structured query language. It can be seen that the present application determines the mapping relationship between different types of database table field types and Java database connection standard types; obtains the table structure of the original table: the fields in the table and the data types of each field, and then maps the original table structure to the Java database connection standard type according to the mapping relationship; maps the Java database connection standard type to a specific database table field type according to the target table type and the mapping relationship, generates the corresponding target table structured query language according to the mapped table structure, and finally executes the structured query language to automatically build a table. In this way, based on Java database connection, automatic mapping of table models between heterogeneous databases and automatic table creation are performed, reducing the complexity of creating heterogeneous database models and improving efficiency.

[0079] Based on the above embodiment, it can be known that the present application can encapsulate the table building process corresponding to the target table and the corresponding logic using code to construct an automatic table building tool. Next, the working process of the automatic table building tool will be described in detail.

[0080] The automatic table creation tool includes the input of source table information and the output of target table information, as follows:

[0081] First, enter the source table database address, database user name, password, table name, etc. to connect to the database, and then obtain the source table structure information and metadata information. According to the obtained source table structure information, convert the field type to a standard field, and develop a metadata model to store detailed information of the table structure. Then enter the database address, database user name, and password information of the target database to connect to the target database to create the target table. Then convert the standard fields to the fields actually supported by the target database, and generate table creation statements. Primary keys, foreign keys, indexes, etc. generate corresponding creation statements according to the database type. Finally, create the target table (for primary keys, foreign keys, and other constraints, make sure they are correctly added in the generated DDL statements. Similarly, indexes also need to be recreated in the target database).

[0082] Through the above steps, the mapping and table creation between heterogeneous databases are completed.

[0083] In this way, the present application can automatically map table models between heterogeneous databases, automatically create tables, reduce the complexity of creating heterogeneous database models, and improve efficiency.

[0084] See also Figure 5 As shown, the embodiment of the present invention discloses a heterogeneous database mapping table building device, including:

[0085] A mapping relationship determination module 11 is used to determine a table field type mapping relationship between the first database and the second database and a Java database connection standard type;

[0086] A first mapping module 12 is used to obtain a first database table field type of the first database, and map the first database table field type to the Java database connection standard type according to the table field type mapping relationship;

[0087] A second mapping module 13 is used to map the Java database connection standard type to a second database table field type corresponding to the second database based on the table field type mapping relationship, and obtain a corresponding mapped database table field type;

[0088] The table creation module 14 is used to generate a table creation structured query language according to the mapped database table field type, and create a target table corresponding to the second database based on the table creation structured query language.

[0089] It can be seen that the present application determines the mapping relationship between different types of database table field types and Java database connection standard types; obtains the table structure of the original table: the fields in the table and the data types of each field, and then maps the original table structure to the Java database connection standard type according to the mapping relationship; maps the Java database connection standard type to a specific database table field type according to the target table type and the mapping relationship, generates the corresponding target table structured query language according to the mapped table structure, and finally executes the structured query language to automatically build the table. In this way, based on Java database connection, the table models between heterogeneous databases are automatically mapped and the table is automatically built, which reduces the complexity of creating heterogeneous database models and improves efficiency.

[0090] In some specific embodiments, the mapping relationship determination module 11 may specifically include:

[0091] A table field type determination unit, used to determine table field types corresponding to the first database and the second database respectively;

[0092] A mapping file creation unit, used to create a data type mapping file based on the table field type and the Java database connection standard type;

[0093] A mapping relationship acquisition unit is used to read the data type mapping file to obtain the table field type mapping relationship between the first database and the second database and the Java database connection standard type.

[0094] In some specific embodiments, the first mapping module 12 may specifically include:

[0095] The first database table field type acquisition unit is used to extract metadata corresponding to the first database table from the first database, and acquire the first database table field type based on the metadata.

[0096] In some specific embodiments, the first database table field type obtaining unit may specifically include:

[0097] The metadata extraction subunit is used to extract metadata corresponding to the first database table from the first database by executing metadata structured query language or using the application programming interface of the first database.

[0098] In some specific embodiments, the device may further include:

[0099] A target structured query language construction module, used to construct a target structured query language according to the metadata and the type construction attributes of the second database;

[0100] A creation module is used to execute the target structured query language to create indexes, foreign keys and attributes of the target table.

[0101] In some specific embodiments, the device may further include:

[0102] The automatic table creation tool construction module is used to encapsulate the table creation process and corresponding logic corresponding to the target table using code to build an automatic table creation tool, so as to create the target table corresponding to the second database based on the automatic table creation tool and the table information corresponding to the first database.

[0103] Furthermore, the present application also discloses an electronic device. Figure 6 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.

[0104] Figure 6A schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the heterogeneous database mapping table building method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0105] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0106] In addition, the memory 22 as a carrier for resource storage may be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon may include an operating system 221, a computer program 222, etc., and the storage method may be temporary storage or permanent storage.

[0107] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the heterogeneous database mapping table building method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.

[0108] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the heterogeneous database mapping table building method disclosed above is implemented. For the specific steps of the method, reference can be made to the corresponding contents disclosed in the above embodiments, and no further description will be given here.

[0109] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0110] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0111] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0112] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the language "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0113] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for mapping and building tables in heterogeneous databases, characterized in that: include: Determine a table field type mapping relationship between the first database and the second database and a Java database connection standard type; Acquire a first database table field type of the first database, and map the first database table field type to the Java database connection standard type according to the table field type mapping relationship; Mapping the Java database connection standard type to a second database table field type corresponding to the second database based on the table field type mapping relationship, and obtaining a corresponding mapped database table field type; A table creation structured query language is generated according to the mapped database table field type, and a target table corresponding to the second database is created based on the table creation structured query language.

2. The heterogeneous database mapping table building method according to claim 1 is characterized in that: The determining of the table field type mapping relationship between the first database and the second database and the Java database connection standard type includes: Determine table field types corresponding to the first database and the second database respectively; Create a data type mapping file based on the table field type and the Java database connection standard type; The data type mapping file is read to obtain a table field type mapping relationship between the first database and the second database and the Java database connection standard type.

3. The heterogeneous database mapping table building method according to claim 1 is characterized in that: The obtaining the first database table field type of the first database includes: Metadata corresponding to a first database table is extracted from the first database, and a field type of the first database table is acquired based on the metadata.

4. The heterogeneous database mapping table building method according to claim 3 is characterized in that: The step of extracting metadata corresponding to the first database table from the first database includes: The metadata corresponding to the first database table is extracted from the first database by executing a metadata structured query language or using an application programming interface of the first database.

5. The heterogeneous database mapping table building method according to claim 3 is characterized in that: The metadata includes table name, field name, field type, primary key and foreign key.

6. The heterogeneous database mapping table building method according to claim 5 is characterized in that: After generating the table building structured query language according to the mapped database table field type, the method further includes: constructing a target structured query language according to the metadata and the type attributes of the second database; The target structured query language is executed to create indexes, foreign keys, and attributes of the target table.

7. The heterogeneous database mapping table building method according to any one of claims 1 to 6, characterized in that: After creating the target table corresponding to the second database based on the table creation structured query language, the method further includes: The table building process and corresponding logic corresponding to the target table are encapsulated using code to construct an automatic table building tool, so as to create a target table corresponding to the second database based on the automatic table building tool and the table information corresponding to the first database.

8. A heterogeneous database mapping table building device, characterized in that: include: A mapping relationship determination module, used to determine the table field type mapping relationship between the first database and the second database and the Java database connection standard type; A first mapping module, used for acquiring a first database table field type of the first database, and mapping the first database table field type to the Java database connection standard type according to the table field type mapping relationship; A second mapping module is used to map the Java database connection standard type to a second database table field type corresponding to the second database based on the table field type mapping relationship, and obtain the corresponding mapped database table field type; A table creation module is used to generate a table creation structured query language according to the mapped database table field type, and create a target table corresponding to the second database based on the table creation structured query language.

9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor is used to execute the computer program to implement the heterogeneous database mapping table building method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: Used to store a computer program, wherein when the computer program is executed by a processor, the heterogeneous database mapping table building method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Data synchronization method, system and equipment for heterogeneous database and storage medium

    CN120123429A