CN112948302B - Method and system for accessing external database based on local interface - Google Patents

Method and system for accessing external database based on local interface Download PDF

Info

Publication number
CN112948302B
CN112948302B CN202110228025.7A CN202110228025A CN112948302B CN 112948302 B CN112948302 B CN 112948302B CN 202110228025 A CN202110228025 A CN 202110228025A CN 112948302 B CN112948302 B CN 112948302B
Authority
CN
China
Prior art keywords
database
external
local
external database
user equipment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110228025.7A
Other languages
Chinese (zh)
Other versions
CN112948302A (en
Inventor
苏章艳
何小栋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Mass Database Technology Co ltd
Original Assignee
Guangzhou Mass Database Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Mass Database Technology Co ltd filed Critical Guangzhou Mass Database Technology Co ltd
Priority to CN202110228025.7A priority Critical patent/CN112948302B/en
Publication of CN112948302A publication Critical patent/CN112948302A/en
Application granted granted Critical
Publication of CN112948302B publication Critical patent/CN112948302B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/382Information transfer, e.g. on bus using universal interface adapter
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method and a system for accessing an external database based on a local interface, wherein the method comprises the following steps: obtaining login information of the user equipment in an external database in a user mapping table according to the identity of the user equipment; calling an external interface of a local database through a local interface, prompting the external interface to establish connection with the external database based on a network address and a port number of the external database, and prompting the external interface to log in the external database based on login information of the external database of the user equipment; converting the plurality of task items into a plurality of processing sequences suitable for being executed in an external database and transmitting the plurality of processing sequences to the external database by an external interface so as to cause the external database to execute the plurality of processing sequences and generate execution results of the plurality of processing sequences; and transmitting the execution results of the plurality of processing sequences to the user equipment via the local interface.

Description

Method and system for accessing external database based on local interface
Technical Field
The present invention relates to the field of database technologies, and in particular, to a method and system for accessing an external database based on a local interface.
Background
With the change of the internet, the database technology is developed vigorously, and various databases are developed endlessly. In order to meet the requirements of different business scenarios, many enterprises and government departments often select a plurality of databases to support business operation according to the characteristics of each database in practical application. However, since the read-write interfaces of each database are inconsistent and drive is not uniform, the service development and operation and maintenance costs are high and the difficulty is high, so that the uniform database read-write interface and the encapsulation of the database difference become a huge challenge for the development of the database.
In order to enable the business to normally run on a plurality of databases, many enterprises and government departments invest in multiple research and development resources and operation and maintenance resources, and the problem that database interfaces and drivers are not uniform is solved by adopting a mode of independent coding aiming at the difference of each database in the business. The service research and development threshold is improved, and the load of the client is increased. This makes the database able to encapsulate other external databases, and providing a uniform read-write management interface is a more urgent need.
Currently, database products or plug-ins providing external database access services support a single database type, most of the database products or plug-ins are external access realized based on each database client, and generally only support a certain database. Under existing conditions, it is almost impossible to access multiple external databases simultaneously in a database. However, the external data wrapper based on JNI and JDBC technology can simultaneously access multiple types of external databases in the same database, does not need to install clients of various databases, and is simple and convenient to operate.
Disclosure of Invention
The invention aims to provide a method and a device for packaging and unifying access interfaces of other external databases in an OpenGauss database, which can realize the access and management of other external databases in the OpenGauss database, package the interface difference of different databases in the OpenGauss database, and use the unified interface of OpenGauss to access and manage other external databases in the OpenGauss database.
According to an aspect of the present invention, there is provided a method of accessing an external database based on a local interface, the method comprising:
starting a local database, initializing a local interface of the local database, and monitoring a user request from user equipment in real time by the local database;
when a user request from user equipment is received, determining a request type related to the user request, and when the request type is reading/writing a table in an external database, analyzing the user request to determine identity information and a processing task of the user equipment, wherein the identity information comprises an identity capable of uniquely identifying the user equipment, and the processing task comprises at least one data task, wherein each data task comprises a plurality of task items, a database identifier of an associated external database and identifier information of an external table;
determining identification information of an external table in an associated external database according to the data task, loading a drive of the external database into a virtual machine of a local database according to a local interface, acquiring a network address and a port number of the external database according to a database identification of the external database, and acquiring login information of the user equipment in the external database in a user mapping table according to an identity identification of the user equipment;
calling an external interface of a local database through a local interface, prompting the external interface to establish connection with the external database based on a network address and a port number of the external database, and prompting the external interface to log in the external database based on login information of the external database of the user equipment;
converting the plurality of task items into a plurality of processing sequences suitable for execution in an external database and transmitting the plurality of processing sequences to the external database by an external interface to cause the external database to execute the plurality of processing sequences and generate execution results of the plurality of processing sequences;
the execution results of the plurality of processing sequences are obtained from an external database via an external interface, and are transmitted to the user equipment via a local interface.
The obtaining the network address and the port number of the external database according to the database identifier of the external database comprises:
and searching in an external service storage area of the local database according to the database identifier of the external database, so as to acquire the network address and the port number of the external database.
The login information of the external database of the user equipment, which is acquired in the user mapping table according to the identity of the user equipment, comprises the following steps:
searching in an external service storage area of a local database according to the identity of the user equipment to determine a local user name of the user equipment;
obtaining login information of the user equipment in an external database in a user mapping table according to a local user name of the user equipment and a database identifier of the external database, wherein the login information of the external database comprises an external user name and an external password of the external database;
wherein the user mapping table comprises: a local user name, a database identification of an external database, and login information of the external database.
When the request type is to create an external table, mapping structure information of the table in the external database to an external table of the local database through an external table function of the local database, wherein the external table of the local database includes only the structure information of the table in the external database and does not contain data of the table in the external database.
Further comprising storing in advance the database identification, the network address and the port number of the external database in the external service storage area.
After initializing the local interface of the local database, the method further comprises:
and initializing the process, and calling a local interface to start a virtual machine of the local database.
And when the request type is closing the database, calling the local interface to close the virtual machine of the local database.
When the request type is to create an external service, a local interface is called to identify a network address, a port number, and a database of the external database in an external service storage area of the local database or in a first dictionary table of the external service storage area.
When the request type is to create the user mapping, the local interface generates a user mapping table by using a local user name of the user equipment, a database identifier of the external database and login information of the external database, and stores the user mapping table in an external service storage area of the local database or a second dictionary table of the external service storage area.
The local interface is a Java local interface JNI, the external interface is a Java database connected with a JDBC interface, and the local database is an OpenGauss database.
And after the local database is started, starting a virtual machine of the local database, wherein the virtual machine is a Java virtual machine.
According to another aspect of the present invention, there is provided a system for accessing an external database based on a local interface, the system comprising:
the initialization device starts a local database and initializes a local interface of the local database, and the local database monitors a user request from user equipment in real time;
the processing device is used for determining a request type related to a user request when the user request is received from user equipment, and when the request type is a table read/written in an external database, analyzing the user request to determine identity information and a processing task of the user equipment, wherein the identity information comprises an identity capable of uniquely identifying the user equipment, and the processing task comprises at least one data task, wherein each data task comprises a plurality of task items, a database identifier of an associated external database and identifier information of an external table;
the driving device determines the identification information of an external table in an associated external database according to the data task, loads the drive of the external database into a virtual machine of a local database according to a local interface, acquires a network address and a port number of the external database according to the database identification of the external database, and acquires the login information of the user equipment in the external database in a user mapping table according to the identity of the user equipment;
a connection device for calling an external interface of the local database through the local interface, prompting the external interface to establish connection with the external database based on a network address and a port number of the external database, and prompting the external interface to log in the external database based on login information of the user equipment in the external database;
a conversion means that converts the plurality of task items into a plurality of processing sequences suitable for execution in the external database and transmits the plurality of processing sequences to the external database by the external interface to cause the external database to execute the plurality of processing sequences and generate execution results of the plurality of processing sequences;
and the transmitting device acquires the execution results of the plurality of processing sequences from an external database through the external interface and transmits the execution results of the plurality of processing sequences to the user equipment through the local interface.
The driving device obtaining the network address and the port number of the external database according to the database identifier of the external database comprises:
and the driving device searches in an external service storage area of the local database according to the database identifier of the external database, so as to acquire the network address and the port number of the external database.
The login information of the external database of the user equipment, which is acquired by the driving device in the user mapping table according to the identity of the user equipment, comprises the following steps:
the driving device searches in an external service storage area of a local database according to the identity of the user equipment so as to determine a local user name of the user equipment;
the drive device obtains login information of the user equipment in an external database in a user mapping table according to a local user name of the user equipment and a database identifier of the external database, wherein the login information of the external database comprises an external user name and an external password of the external database;
wherein the user mapping table comprises: a local user name, a database identification of an external database, and login information of the external database.
When the request type is to create an external table, mapping structure information of a table in the external database to an external table of the local database through an external table function of the local database, wherein the external table of the local database includes only the structure information of the table in the external database and does not contain data of the table in the external database.
Further comprising storing in advance the database identification, the network address and the port number of the external database in the external service storage area.
The initialization device, after initializing the local interface of the local database, further includes:
the initialization device carries out process initialization and calls a local interface to start a virtual machine of a local database.
When the request type is closing the database, the processor device calls the local interface to close the virtual machine of the local database.
When the request type is to create an external service, the processing device calls the local interface to identify the network address, the port number and the database of the external database in the external service storage area of the local database or in the first dictionary table of the external service storage area.
When the request type is to create a user mapping, the processing device causes the local interface to generate a user mapping table using a local user name of the user device and a database identification of the external database and login information of the external database, and store the user mapping table in an external service storage area of the local database or a second dictionary table of the external service storage area.
The system comprises a local interface, an external interface and an OpenGauss database, wherein the local interface is a Java local interface JNI, the external interface is a Java database connected with a JDBC interface, and the local database is an OpenGauss database.
And after the local database is started, starting a virtual machine of the local database, wherein the virtual machine is a Java virtual machine.
Drawings
A more complete understanding of exemplary embodiments of the present invention may be had by reference to the following drawings in which:
FIG. 1 is a flow diagram of a method for accessing an external database based on a local interface according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a corresponding relationship between an OpenGauss object and an external database object according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a system architecture according to an embodiment of the invention;
FIG. 4 is a flowchart of operation according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a system for accessing an external database based on a local interface according to an embodiment of the present invention.
Detailed Description
FIG. 1 is a flow diagram of a method 100 for accessing an external database based on a local interface, according to an embodiment of the invention. The method 100 starts at step 101.
In step 101, a local database is started, a local interface of the local database is initialized, and the local database listens for a user request from a user equipment in real time.
In step 102, when a user request from a user equipment is received, a request type related to the user request is determined, and when the request type is reading/writing a table in an external database, the user request is analyzed to determine identity information and a processing task of the user equipment, wherein the identity information comprises an identity capable of uniquely identifying the user equipment, and the processing task comprises at least one data task, wherein each data task comprises a plurality of task items, a database identification of an associated external database and identification information of an external table.
In step 103, the identification information of the external table in the associated external database is determined according to the data task, the driver of the external database is loaded into the virtual machine of the local database according to the local interface, the network address and the port number of the external database are obtained according to the database identification of the external database, and the login information of the user equipment in the external database is obtained in the user mapping table according to the identity of the user equipment.
In step 104, an external interface of the local database is invoked via the local interface, the external interface is caused to establish a connection with the external database based on the network address and port number of the external database, and the external interface is caused to log into the external database based on the login information of the user device in the external database.
At step 105, the plurality of task items are converted into a plurality of processing sequences suitable for execution in the external database and the plurality of processing sequences are transmitted to the external database by the external interface to cause the external database to execute the plurality of processing sequences and generate execution results of the plurality of processing sequences.
In step 106, the execution results of the plurality of processing sequences are obtained from the external database via the external interface and are sent to the user equipment via the local interface.
The acquiring the network address and the port number of the external database according to the database identifier of the external database comprises: and searching in an external service storage area of the local database according to the database identifier of the external database, so as to acquire the network address and the port number of the external database. The login information of the external database of the user equipment, which is acquired in the user mapping table according to the identity of the user equipment, comprises the following steps: searching in an external service storage area of a local database according to the identity of the user equipment to determine a local user name of the user equipment; obtaining login information of the user equipment in an external database in a user mapping table according to a local user name of the user equipment and a database identifier of the external database, wherein the login information of the external database comprises an external user name and an external password of the external database; wherein the user mapping table comprises: a local user name, a database identification of an external database, and login information of the external database.
When the request type is to create an external table, mapping structure information of the table in the external database to an external table of the local database through an external table function of the local database, wherein the external table of the local database includes only the structure information of the table in the external database and does not contain data of the table in the external database. Further comprising storing in advance the database identification, the network address and the port number of the external database in the external service storage area. After initializing the local interface of the local database, the method further comprises: and initializing the process, and calling a local interface to start a virtual machine of the local database. And when the request type is closing the database, calling the local interface to close the virtual machine of the local database.
When the request type is to create an external service, a local interface is called to identify a network address, a port number, and a database of the external database in an external service storage area of the local database or in a first dictionary table of the external service storage area. When the request type is to create a user mapping, the local interface generates a user mapping table by using a local user name of the user equipment, a database identifier of the external database and login information of the external database, and stores the user mapping table in an external service storage area of the local database or a second dictionary table of the external service storage area. The local interface is a Java local interface JNI, the external interface is a Java database connected with a JDBC interface, and the local database is an OpenGauss database. And after the local database is started, starting a virtual machine of the local database, wherein the virtual machine is a Java virtual machine.
Fig. 2 is a schematic diagram of a corresponding relationship between an OpenGauss object and an external database object according to an embodiment of the present invention. Firstly, an OpenGauss database, a JNI and a JDBC interface are introduced: the OpenGauss database is an open source code relational database management system, and is evolved based on the open source database PostgreSQL. JDBC: java Database Connectivity (Java Database Connectivity) is an application program interface in the Java language that specifies how client programs access databases, providing methods such as querying and updating data in databases. Most databases currently provide a standard JDBC interface. JNI: java Native Interface (Java Native fast) by using Java Native Interface to write programs, it can ensure the code to be convenient to be transplanted on different platforms. OpenGauss is written in C + +, and JAVA codes can be called in an OpenGauss database through JNI.
The present invention manages the external database and the object information in the external database by using the following functions in the OpenGauss database, and the schematic diagram of the object relationship is shown in fig. 2. External service: and through the external service function of the OpenGauss database, the information such as the IP (Internet protocol), the port, the database name and the like of the external database is saved. Corresponding to the external server in fig. 2. User mapping: and mapping the user password of the external database to the user of the OpenGauss database through the user mapping function of the OpenGauss. Corresponding to the user mapping in fig. 2. External table: and mapping the table structure information in the external database to the external table of the OpenGauss database through the external table function of the OpenGauss, wherein the table structure information is only stored and does not contain table data. Corresponding to the external table in fig. 2.
The user maps the object information of the external service to the OpenGauss database object according to the following steps:
1. firstly, creating external services, wherein information such as IP (Internet protocol), ports and database names of an external database is stored in a dictionary table pg _ foreign _ server of an OpenGauss database;
2. then, creating a user mapping of the external service, wherein the step stores the mapping relation between the OpenGauss user and an external database user and the password of the external database user into a dictionary table pg _ user _ mapping of the OpenGauss database;
3. and finally, creating an external table under the external service, namely a table in an external database which needs to be accessed in an OpenGauss database, wherein the step is to create a table in OpenGauss, store the information of the table into dictionary tables such as pg _ class and pg _ attribute, but mark the table as an external table to indicate that the data is stored in the external database instead of the current OpenGauss database.
FIG. 3 is a schematic diagram of a system architecture according to an embodiment of the present invention. The invention relates to a method for accessing an external database in an OpenGauss database through JNI and JDBC interfaces. On the basis, the invention further provides a method for realizing the access of the external database in the OpenGauss database, and the technical architecture is shown in FIG. 3.OpenGauss is a database realized by C + + coding, JDBC drivers of other databases are called in the OpenGauss through JNI interfaces to access remote database read and write data, and as most databases provide JDBC interfaces, access to the database in the OpenGauss database can be realized through the method as long as the database can provide JDBC interfaces.
FIG. 4 is a flowchart of operation according to an embodiment of the present invention. When a user reads and writes external database table data in an OpenGauss database, the processing flow of the OpenGauss database process is as follows (as shown in fig. 4):
in the database startup phase, a JNI _ createjavvm interface is called, and a JVM (Java virtual machine) environment is started in a database process (see the detailed flow of a "start database" sub-module in fig. 4). The JVM will exist throughout the database's operational lifecycle; when the database is closed, the JVM environment is closed by the destroyjava vm (see fig. 4 for details, the "close database" sub-module flow).
In addition, the method also comprises process initialization and other subsequent operations after the JNI interface is called to start the JVM.
And after the database is started, normally receiving a user request, and analyzing the user request so as to determine the type of the user request. The types of user requests include: creating external services, creating user mappings, creating external tables, reading and writing external tables, and closing databases.
When the type of the user request is that the user reads and writes external table data in the OpenGauss database, the following processing is performed in the database (see fig. 4 for details, the "read and write external table" sub-module flow):
1. acquiring external table information, and calling a JNI (Java native interface) interface to load JDBC (java database connectivity) drivers of external databases corresponding to external tables into a JVM (java virtual machine) environment;
2. reading external services of the table, and extracting information such as IP (Internet protocol), ports, database names and the like of an external database stored in the external services;
3. reading user mapping of external service, and acquiring a user password of an external database of the current user mapping;
4. calling JAVA codes through interfaces such as FindClass/GetMethodID/CallObjectMethod and the like in JNI, and acquiring connection of an external database through a JDBC driver of the external database;
5. calling JAVA codes through a JNI interface, and sending the processed SQL to an external database for execution through the connection acquired above;
6. and calling the JAVA code through the JNI interface, acquiring an SQL execution result and returning the SQL execution result to the client.
And when the type of the user request is closing the database, calling a JNI interface to close the JVM and other subsequent closing operations.
When the type of the user request is to create an external service, create a user map, or create an external table, the processes of creating the external service, creating the user map, or creating the external table are performed, respectively.
Fig. 5 is a schematic structural diagram of a system 500 for accessing an external database based on a local interface according to an embodiment of the present invention. The system 500 includes: initialization means 501, processing means 502, driving means 503, connection means 504, conversion means 505 and transmission means 506.
The initializing device 501 starts a local database, initializes a local interface of the local database, and the local database monitors a user request from a user equipment in real time. The initialization apparatus 501 further includes, after initializing the local interface of the local database: the initialization device 501 performs process initialization, and calls a local interface to start a virtual machine of a local database.
The processing device 502 determines a request type to which a user request is related when the user request is received from a user equipment, and when the request type is reading/writing a table in an external database, parses the user request to determine identity information and a processing task of the user equipment, wherein the identity information includes an identity capable of uniquely identifying the user equipment, and the processing task includes at least one data task, wherein each data task includes a plurality of task items, a database identification of an associated external database, and identification information of an external table. When the request type is to close the database, the processor device 502 calls the local interface to close the virtual machine of the local database. When the request type is to create an external service, the processing means 502 calls the local interface to identify the network address, the port number and the database of the external database in the external service storage area of the local database or in the first dictionary table of the external service storage area. When the request type is to create a user mapping, the processing means 502 causes the local interface to generate a user mapping table using the local user name of the user device, the database identification of the external database, and the login information of the external database, store the user mapping table in the external service storage area of the local database or in the second dictionary table of the external service storage area.
The driving device 503 determines the identification information of the external table in the associated external database according to the data task, loads the drive of the external database into the virtual machine of the local database according to the local interface, obtains the network address and the port number of the external database according to the database identification of the external database, and obtains the login information of the user equipment in the external database in the user mapping table according to the identity of the user equipment. The driving apparatus 503 obtaining the network address and the port number of the external database according to the database identifier of the external database includes: the drive apparatus 503 performs a search in the external service storage area of the local database based on the database identification of the external database, thereby acquiring the network address and the port number of the external database. The login information of the external database of the user equipment, which is obtained by the driving apparatus 503 in the user mapping table according to the identity of the user equipment, includes: the driving device 503 searches in the external service storage area of the local database according to the identity of the user equipment to determine the local user name of the user equipment; the driving apparatus 503 obtains login information of the external database of the user equipment in the user mapping table according to the local user name of the user equipment and the database identifier of the external database, where the login information of the external database includes the external user name and the external password of the external database; wherein the user mapping table comprises: a local user name, a database identification of an external database, and login information of the external database.
The connection means 504, which calls the external interface of the local database through the local interface, causes the external interface to establish a connection with the external database based on the network address and the port number of the external database, and causes the external interface to log in the external database based on the login information of the user equipment with the external database.
The conversion device 505 converts the plurality of task items into a plurality of processing sequences suitable for being executed in the external database and transmits the plurality of processing sequences to the external database by the external interface, so as to cause the external database to execute the plurality of processing sequences and generate execution results of the plurality of processing sequences.
The sending device 506 obtains the execution results of the plurality of processing sequences from the external database via the external interface, and sends the execution results of the plurality of processing sequences to the user equipment via the local interface.
When the request type is to create an external table, mapping structure information of the table in the external database to an external table of the local database through an external table function of the local database, wherein the external table of the local database includes only the structure information of the table in the external database and does not contain data of the table in the external database. Further comprising storing in advance the database identification, the network address and the port number of the external database in the external service storage area. The local interface is a Java local interface JNI, the external interface is a Java database connected with a JDBC interface, and the local database is an OpenGauss database. And after the local database is started, starting a virtual machine of the local database, wherein the virtual machine is a Java virtual machine.

Claims (8)

1. A method of accessing an external database based on a local interface, the method comprising:
starting a local database, initializing a local interface of the local database, monitoring a user request from user equipment in real time by the local database, wherein the local database is an OpenGauss database;
when a user request from user equipment is received, determining a request type related to the user request, and when the request type is a table read/written in an external database, analyzing the user request to determine identity information and a processing task of the user equipment, wherein the identity information comprises an identity capable of uniquely identifying the user equipment, and the processing task comprises at least one data task, wherein each data task comprises a plurality of task items, a database identifier of an associated external database and identifier information of an external table; when the request type is to create an external table, mapping the structure information of the table in the external database to the external table of the local database through an external table function of the local database, wherein the external table of the local database only comprises the structure information of the table in the external database and does not contain the data of the table in the external database;
determining identification information of an external table in an associated external database according to the data task, loading a drive of the external database into a virtual machine of a local database according to a local interface, acquiring a network address and a port number of the external database according to a database identification of the external database, and acquiring login information of the user equipment in the external database in a user mapping table according to an identity identification of the user equipment;
calling an external interface of a local database through a local interface, prompting the external interface to establish connection with the external database based on a network address and a port number of the external database, and prompting the external interface to log in the external database based on login information of the external database of the user equipment;
converting the plurality of task items into a plurality of processing sequences suitable for execution in an external database and transmitting the plurality of processing sequences to the external database by an external interface to cause the external database to execute the plurality of processing sequences and generate execution results of the plurality of processing sequences;
the execution results of the plurality of processing sequences are obtained from an external database via an external interface, and are transmitted to the user equipment via a local interface.
2. The method of claim 1, wherein obtaining the network address and the port number of the external database from the database identification of the external database comprises:
and searching in an external service storage area of the local database according to the database identifier of the external database, so as to acquire the network address and the port number of the external database.
3. The method of claim 1, wherein the login information of the external database of the user equipment obtained in the user mapping table according to the identity of the user equipment comprises:
searching in an external service storage area of a local database according to the identity of the user equipment to determine a local user name of the user equipment;
obtaining login information of the user equipment in an external database in a user mapping table according to a local user name of the user equipment and a database identifier of the external database, wherein the login information of the external database comprises an external user name and an external password of the external database;
wherein the user mapping table comprises: a local user name, a database identification of an external database, and login information of the external database.
4. The method according to claim 1, further comprising storing in advance a database identification, a network address, and a port number of the external database in the external service storage area.
5. A system for accessing an external database based on a local interface, the system comprising:
the initialization device starts a local database and initializes a local interface of the local database, and the local database monitors a user request from user equipment in real time;
the processing device is used for determining a request type related to a user request when the user request is received from user equipment, and when the request type is a table read/written in an external database, analyzing the user request to determine identity information and a processing task of the user equipment, wherein the identity information comprises an identity capable of uniquely identifying the user equipment, and the processing task comprises at least one data task, wherein each data task comprises a plurality of task items, a database identifier of an associated external database and identifier information of an external table; when the request type is to create an external table, mapping the structure information of the table in the external database to the external table of the local database through an external table function of the local database, wherein the external table of the local database only comprises the structure information of the table in the external database and does not contain the data of the table in the external database;
the driving device determines identification information of an external table in an associated external database according to the data task, loads the driving of the external database into a virtual machine of a local database according to a local interface, acquires a network address and a port number of the external database according to a database identification of the external database, and acquires login information of the user equipment in the external database in a user mapping table according to an identity identification of the user equipment;
a connection device for calling an external interface of the local database through the local interface, prompting the external interface to establish connection with the external database based on a network address and a port number of the external database, and prompting the external interface to log in the external database based on login information of the user equipment in the external database;
a conversion means that converts the plurality of task items into a plurality of processing sequences suitable for execution in the external database and transmits the plurality of processing sequences to the external database by the external interface to cause the external database to execute the plurality of processing sequences and generate execution results of the plurality of processing sequences;
and the transmitting device acquires the execution results of the plurality of processing sequences from the external database through the external interface and transmits the execution results of the plurality of processing sequences to the user equipment through the local interface.
6. The system of claim 5, the driver device obtaining the network address and the port number of the external database according to the database identifier of the external database comprises:
and the driving device searches in an external service storage area of the local database according to the database identifier of the external database, so as to acquire the network address and the port number of the external database.
7. The system of claim 5, wherein the login information of the external database of the user equipment, which is obtained by the driving apparatus in the user mapping table according to the identity of the user equipment, comprises:
the driving device searches in an external service storage area of a local database according to the identity of the user equipment so as to determine a local user name of the user equipment;
the driving device acquires login information of the user equipment in an external database in a user mapping table according to a local user name of the user equipment and a database identifier of the external database, wherein the login information of the external database comprises an external user name and an external password of the external database;
wherein the user mapping table comprises: a local user name, a database identification of an external database, and login information of the external database.
8. The system according to claim 5, further comprising storing in advance a database identification, a network address, and a port number of the external database in the external service storage area.
CN202110228025.7A 2021-03-02 2021-03-02 Method and system for accessing external database based on local interface Active CN112948302B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110228025.7A CN112948302B (en) 2021-03-02 2021-03-02 Method and system for accessing external database based on local interface

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110228025.7A CN112948302B (en) 2021-03-02 2021-03-02 Method and system for accessing external database based on local interface

Publications (2)

Publication Number Publication Date
CN112948302A CN112948302A (en) 2021-06-11
CN112948302B true CN112948302B (en) 2022-11-08

Family

ID=76247057

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110228025.7A Active CN112948302B (en) 2021-03-02 2021-03-02 Method and system for accessing external database based on local interface

Country Status (1)

Country Link
CN (1) CN112948302B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108363741A (en) * 2018-01-22 2018-08-03 中国平安人寿保险股份有限公司 Big data unified interface method, apparatus, equipment and storage medium
CN110837492A (en) * 2019-11-15 2020-02-25 中科院计算技术研究所大数据研究院 Method for providing data service by multi-source data unified SQL
CN111752965A (en) * 2020-05-29 2020-10-09 南京南瑞继保电气有限公司 Real-time database data interaction method and system based on micro-service

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101777047A (en) * 2009-01-08 2010-07-14 国际商业机器公司 System, equipment and method for accessing database under multiple-tenant environment
CN102739654B (en) * 2012-06-08 2015-03-18 北京久其软件股份有限公司 Method for realizing application program to access database
CN103488765A (en) * 2013-09-28 2014-01-01 雷虹 Access drive and data access method of proxy database
EP3401820B1 (en) * 2017-05-10 2019-12-18 Siemens Aktiengesellschaft Apparatus and method for providing a secure database access
US20190205436A1 (en) * 2017-12-29 2019-07-04 Comptel Oy System and method for executing database operations on a database

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108363741A (en) * 2018-01-22 2018-08-03 中国平安人寿保险股份有限公司 Big data unified interface method, apparatus, equipment and storage medium
CN110837492A (en) * 2019-11-15 2020-02-25 中科院计算技术研究所大数据研究院 Method for providing data service by multi-source data unified SQL
CN111752965A (en) * 2020-05-29 2020-10-09 南京南瑞继保电气有限公司 Real-time database data interaction method and system based on micro-service

Also Published As

Publication number Publication date
CN112948302A (en) 2021-06-11

Similar Documents

Publication Publication Date Title
US7483959B2 (en) Method and system for extensible data gathering
US20180278471A1 (en) Generic connector module capable of integrating multiple applications into an integration platform
US20120047239A1 (en) System and Method for Installation and Management of Cloud-Independent Multi-Tenant Applications
EP2093675A1 (en) Document base system and method for extending the function of the document base system
CN109558320B (en) System testing method, device, system, equipment and computer readable storage medium
US20210149895A1 (en) Query conversion for querying disparate data sources
CN110569298A (en) data docking and visualization method and system
CN114385091A (en) Method and device for realizing network disk drive character, network disk and storage medium
CN111026931A (en) Data query method, device, equipment and medium
CN110826057B (en) Analysis method for data processing path, computer device, and storage medium
CN112948302B (en) Method and system for accessing external database based on local interface
US20160283522A1 (en) Matching untagged data sources to untagged data analysis applications
CN112084199A (en) Scene-based general parameter maintenance method and device
CN110881030A (en) Logstack-based method and device for recording operation logs of web service administrator
CN110471708B (en) Method and device for acquiring configuration items based on reusable components
CN113656183A (en) Task processing method, device, equipment and storage medium
CN112148450A (en) Data processing method, device, equipment and storage medium
CN110688201A (en) Log management method and related equipment
CN111782428B (en) Data calling system and method
CN108984701A (en) Data managing method and device in cloud data system
CN113687878B (en) Information interaction method, device, equipment and storage medium
CN116974653B (en) Class loading method and system
CN117118962B (en) Method and system for deploying user methods across multiple cloud platforms
CN113176876B (en) Data reading and writing method and device and electronic equipment
CN110442629B (en) Big data multi-center heterogeneous dynamic data conversion method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant