CN115168358A - Database access method and device, electronic equipment and storage medium - Google Patents

Database access method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115168358A
CN115168358A CN202210843120.2A CN202210843120A CN115168358A CN 115168358 A CN115168358 A CN 115168358A CN 202210843120 A CN202210843120 A CN 202210843120A CN 115168358 A CN115168358 A CN 115168358A
Authority
CN
China
Prior art keywords
database
processing engine
data processing
data
target
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.)
Pending
Application number
CN202210843120.2A
Other languages
Chinese (zh)
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.)
GCL Hong Kong Cloud Technology Hainan Co Ltd
Original Assignee
GCL Hong Kong Cloud Technology Hainan 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 GCL Hong Kong Cloud Technology Hainan Co Ltd filed Critical GCL Hong Kong Cloud Technology Hainan Co Ltd
Priority to CN202210843120.2A priority Critical patent/CN115168358A/en
Publication of CN115168358A publication Critical patent/CN115168358A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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/21Design, administration or maintenance of databases
    • 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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • 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/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt

Abstract

The embodiment of the invention discloses a database access method, a database access device, electronic equipment and a storage medium. The method comprises the following steps: receiving at least one database access instruction based on a data processing engine; responding to the database access instruction, and connecting a target database by calling a self-defined bridge which is predefined to correspond to the data processing engine so as to access the target database. The technical scheme of the embodiment of the invention solves the technical problem of higher development and maintenance cost of accessing the database by the data processing engine in the prior art, realizes that the data processing engine can access the database by a small amount of codes, and achieves the technical effect of reducing the development and maintenance cost of the codes.

Description

Database access method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a database access method and apparatus, an electronic device, and a storage medium.
Background
At present, the way that a data processing engine (e.g., a Flink data processing engine) accesses a database generally requires a developer to write corresponding code for connecting to the database for each service, and then to connect to the database, so as to access the database. The database access method has the technical problems of high code quantity and high code coupling degree, so that the development and maintenance cost of the codes is high.
Disclosure of Invention
The invention provides a database access method, a database access device, electronic equipment and a storage medium, which can realize that a data processing engine can access a database by developing a small amount of codes, thereby achieving the technical effect of reducing the code development and maintenance cost.
According to an aspect of the present invention, there is provided a database access method, the method including:
receiving at least one database access instruction based on a data processing engine;
responding to the database access instruction, and connecting a target database by calling a self-defined bridge which is predefined to correspond to the data processing engine so as to access the target database.
According to another aspect of the present invention, there is provided a database access apparatus including:
the instruction receiving module is used for receiving at least one database access instruction based on the data processing engine;
and the database access module is used for responding to the database access instruction, and connecting a target database by calling a self-defined bridge which is predefined and corresponds to the data processing engine so as to access the target database.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein, the first and the second end of the pipe are connected with each other,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the database access method of any of the embodiments of the invention.
According to another aspect of the present invention, there is provided a computer-readable storage medium storing computer instructions for causing a processor to implement the database access method according to any one of the embodiments of the present invention when the computer instructions are executed.
According to the technical scheme of the embodiment of the invention, at least one database access instruction is received based on the data processing engine. That is, the data processing engine may receive one or more database access instructions. In response to a database access instruction, a custom bridge corresponding to the data processing engine may be predefined by calling. The data processing engine is connected with the target database through the custom bridge, and the target database can be accessed after the data processing engine is connected with the target database. The technical scheme of the embodiment of the invention solves the technical problem of higher development and maintenance cost in the prior art that the data processing engine accesses the database, realizes that the data processing engine can access the database through a small amount of codes, and achieves the technical effect of reducing the development and maintenance cost of the codes.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present invention, nor do they necessarily limit the scope of the invention. Other features of the present invention will become apparent from the following description.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of a database access method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a database access method according to a second embodiment of the present invention;
fig. 3 is a schematic flowchart of a database access method according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of a database access apparatus according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to a fifth embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein.
Example one
Fig. 1 is a flowchart of a database access method according to an embodiment of the present invention, where the present embodiment is applicable to a scenario in which a data processing engine accesses a database, and is particularly applicable to a case in which a distributed stream data engine accesses a database, where the method may be performed by a database access device, where the database access device may be implemented in a form of hardware and/or software, and the database access device may be configured in the database access device. As shown in fig. 1, the method includes:
and S110, receiving at least one database access instruction based on the data processing engine.
The data processing engine may be a distributed stream data engine (e.g., flink), among others. The database access instruction is an instruction for operating the database, which is generated according to a preset description rule, for example, a database access instruction described by a structured database language. The data access instruction can carry at least one item of information of a database name and information of a storage position where the database is located.
In particular, one or more database access instructions are received by a data processing engine. Wherein, one or more database access instructions are received by the data processing engine, it is understood that one or more database access instructions are received by the data processing engine, which are input by a user based on the input device. The input device may be a physical device (e.g., a keyboard and/or a mouse) or a virtual device (e.g., a virtual keyboard or a virtual input area), among others.
And S120, responding to the database access instruction, and connecting the target database by calling a self-defined bridge which is predefined and corresponds to the data processing engine so as to access the target database.
Wherein, the target database can be understood as a database that the data processing engine needs to access. The custom bridge may be a file package obtained by packaging at least one base class for connecting the database. The portfolio can be a Java Archive File (JAR) File. The custom bridge may be used to establish a connection of the data processing engine to the target database.
Taking the example that the database accessed by the Flink is the tdegenine database, the predefined custom bridge for the Flink to access the tdegenine database may be a jar packet (e.g., flink-connector-jdbc _ 2.11-1.14-snap. Wherein, the JdbcDialect class may include a method of overwriting getupdatestatelement based on a keyword stride.
Specifically, a bridge corresponding to the data processing engine and used for being connected with the database is predefined, and the predefined bridge is used as a custom bridge. Then, after the data processing engine receives the database access instruction, the code of the custom bridge may be executed by calling the custom bridge. After the code execution of the custom bridge is completed, the data processing engine may be connected to the target database. After the data processing engine is successfully connected with the target database, the data processing engine can access the target database.
Further, in practical applications, the number of database access instructions received by the data processing engine is usually multiple. Specifically, for each database access instruction received by the data processing engine, the custom bridge may be invoked, thereby establishing a connection between the data processing engine and the target database. Compared with the prior art, after the data processing engine receives a plurality of database access instructions, the code for connecting the database corresponding to the database access instructions needs to be determined. For each instruction, the corresponding code for linking to the database is executed. And then connecting the target database. In the embodiment of the invention, the bridge used for connecting the database is defined in advance and is connected with the target database, so that the development cost and the maintenance cost of codes can be reduced, the memory occupation can be reduced, and the distribution quantity of threads can be reduced.
In order to facilitate invoking the custom bridge, after the custom bridge is obtained, the custom bridge may be uploaded to a project engineering file in the data processing engine, so that the project may share and refer to the custom bridge. Alternatively, the custom bridge may be uploaded into a project root file (root file) of the data processing engine.
Optionally, the method calls a predefined bridge corresponding to the data processing engine to connect the target database by the following steps:
step one, aiming at each database access instruction, a user-defined bridge corresponding to a data processing engine is called to analyze the database access instruction to obtain a database name of a target database.
Specifically, for each database access instruction received by the data processing engine, a custom bridge corresponding to the data processing engine may be determined. And then the database access instruction can be analyzed by calling the custom bridge for analysis. Thus, the database name of the target database included in the database access instruction can be determined, that is, the database name of the target database can be obtained.
And step two, generating a first database execution statement for connecting the target database based on the database name.
Wherein the first database execution statement may be used to connect to the target database. The first database execution statement may include a database name, a database username, a database password, and a database server name or IP address.
And step three, connecting the target database by executing the first database execution statement.
Specifically, after the first database execution statement is generated, the first database statement may be loaded into the memory, and a thread may be allocated to the first database execution statement. After the thread allocation is complete, a first database execution statement may be executed in memory on a thread-by-thread basis. After execution is complete, a connection of the data processing engine to the target database may be established.
According to the technical scheme of the embodiment of the invention, at least one database access instruction is received based on the data processing engine. That is, the data processing engine may receive one or more database access instructions. In response to a database access instruction, a custom bridge corresponding to the data processing engine may be predefined by calling. The data processing engine is connected with the target database through the custom bridge, and the target database can be accessed after the data processing engine is connected with the target database. The technical scheme of the embodiment of the invention solves the technical problem of higher development and maintenance cost in the prior art that the data processing engine accesses the database, realizes that the data processing engine can access the database through a small amount of codes, and achieves the technical effect of reducing the development and maintenance cost of the codes.
Example two
Fig. 2 is a flowchart of a database access method provided in the second embodiment of the present invention, where on the basis of the foregoing embodiment, optionally, the invoking defines a custom bridge corresponding to the data processing engine in advance, and connects to a target database, including: and calling the pre-defined custom bridge corresponding to the data processing engine through a database connecting component of the data processing engine to connect a target database. The technical terms that are the same as or corresponding to the above embodiments are not repeated herein.
As shown in fig. 2, the method of the embodiment may specifically include:
s210, receiving at least one database access instruction based on the data processing engine.
And S220, responding to the database access instruction, calling a self-defined bridge corresponding to the database connecting component through the database connecting component of the data processing engine, and connecting the self-defined bridge with the target database to access the target database.
Wherein the data processing engine comprises a database connection component. The database connection component of Flink is a Flink Structured Query Language (Flink SQL) component. The Flink SQL is a set of development languages which are designed by reducing the real-time calculation threshold used by a user and meet the standard SQL semantics because the Flink SQL is a simplified calculation model calculated in real time.
Specifically, a bridge corresponding to the database connection component of the data processing engine is predefined, that is, a custom bridge is predefined. And after the data processing engine receives the database access instruction, the user-defined bridge can be called through the database connecting component of the data processing engine. After the call is completed, the connection of the database connection component and the target database can be established. After the connection is successfully established, the data processing engine can access the target database, and further, the technical problem that the database connection component of the data processing engine cannot establish the connection between the data processing engine and the target database in the prior art is solved.
Optionally, a predefined custom bridge corresponding to the data processing engine is called by the database connection component of the data processing engine through the following steps, and is connected to the target database:
step one, determining a predefined storage path of a custom bridge corresponding to a database connecting component.
Specifically, a storage location for storing a predefined custom bridge corresponding to the database connection component is used as a storage path of the custom bridge corresponding to the database connection component. The storage path may be a relative storage path of the custom bridge, or may be an absolute storage path of the custom bridge, which is not specifically limited herein.
And step two, loading the custom bridge in the storage path into a data processing engine, and calling the custom bridge through a database connecting component of the data processing engine.
Specifically, after the storage path of the custom bridge is determined, the custom bridge in the storage path can be loaded to the preset storage position of the data processing engine, so that the custom bridge can be updated conveniently and rapidly in the following process. After loading is complete, the custom bridge may be invoked by a database connection component of the data processing engine.
According to the technical scheme of the embodiment of the invention, the user-defined bridge corresponding to the database connecting component is called by the database connecting component of the data processing engine in advance to be connected with the target database so as to access the target database, so that the technical problem that the database connecting component of the data processing engine cannot establish the connection between the data processing engine and the target database in the prior art is solved, the connection between the data processing engine and the target database is realized, and the technical effect of reducing the cost of developing and maintaining codes is achieved.
EXAMPLE III
Fig. 3 is a flowchart of a database access method provided in a third embodiment of the present invention, on the basis of the foregoing embodiment, optionally, after the target database is connected, the method further includes: analyzing the data acquisition instruction received by the data processing engine by calling the custom bridge to generate a second database execution statement for acquiring data in a target database; and executing the second database execution statement by calling a data acquisition component of the data processing engine, and acquiring query data corresponding to the second database execution statement from the target database. The technical terms that are the same as or corresponding to the above embodiments are not repeated herein.
As shown in fig. 3, the method of the present embodiment may specifically include:
s310, receiving at least one database access instruction based on the data processing engine.
And S320, responding to the database access instruction, and connecting the target database by calling a self-defined bridge which is defined in advance and corresponds to the data processing engine.
S330, analyzing the data acquisition instruction received by the data processing engine by calling the custom bridge to generate a second database execution statement for acquiring data in the target database.
The data acquisition instruction can be used for reading data in the target database. The data obtaining instruction may include a table name of the data table to be accessed, a field to be accessed in the data table to be accessed, and a data operation command of the field to be accessed. The data manipulation command may include at least one of an add data command, a delete data command, and a query data command. The second database execution statement may be a row of multiple rows of statements that operate on the database and may be used to operate on data in the target database.
Specifically, after the data processing engine is connected to the target database, the data acquisition instruction received by the data processing engine may be further determined. And then the user-defined bridge can be called to analyze the data acquisition instruction received by the data processing engine. Therefore, the name of the data table to be accessed in the data acquisition instruction, the field to be accessed in the data table to be accessed and the data operation command of the field to be accessed can be determined. And further, a second database execution statement for acquiring data in the target database can be generated based on the table name of the data table to be accessed, the field to be accessed and the data operation command.
And S340, executing a second database execution statement by calling a data acquisition component of the data processing engine, and acquiring query data corresponding to the second database execution statement from the target database.
Query data may be understood as data that the data processing engine needs to read from the target database. The number of query data may be one, two or more. It should be noted that the query data may be data of one or more data tables in the target database.
Specifically, after the second database execution statement is generated, the second database execution statement may be parsed by calling a data acquisition component of the data processing engine based on the syntax rule of the target database. Query data in the target database corresponding to the second database execution statement may then be determined. After determining the query data, the query data may be obtained, i.e., the data processing engine may read the query data in the target database.
Optionally, after obtaining the query data corresponding to the second database execution statement from the target database, the query data may be mapped to a pre-created data table, so that the data table stores the query data.
The pre-created data table may be a one-dimensional data table or a two-dimensional data table. The pre-created data table may be used to store query data.
Specifically, after the query data is determined, a storage path for storing a pre-created data table may be determined. The pre-created data table may then be loaded into the data processing engine based on the storage path used to store the pre-created data table. After the loading is complete, the query data may be mapped into a pre-created data table. Therefore, the query data are stored in the preset created data table.
According to the technical scheme of the embodiment of the invention, after the target database is connected, the data acquisition instruction received by the data processing engine can be analyzed by calling the custom bridge, and the second database execution statement for acquiring the data in the target database is generated. And the data processing engine is called to execute the second database execution statement and acquire the query data corresponding to the second database execution statement from the target database, so that the data processing engine reads the data in the target database.
Example four
Fig. 4 is a schematic structural diagram of a database access device according to a fourth embodiment of the present invention. As shown in fig. 4, the apparatus includes: an instruction receiving module 410 and a database access module 420.
Wherein, the instruction receiving module 410 is configured to receive at least one database access instruction based on the data processing engine; and the database access module 420 is configured to respond to the database access instruction, and connect to a target database by invoking a custom bridge predefined to correspond to the data processing engine, so as to access the target database.
According to the technical scheme of the embodiment of the invention, at least one database access instruction is received by the instruction receiving module based on the data processing engine. That is, the data processing engine may receive one or more database access instructions. Responding to a database access instruction through a database access module, and calling a self-defined bridge corresponding to the data processing engine in advance. The data processing engine is connected with the target database through the custom bridge, and the target database can be accessed after the data processing engine is connected with the target database. The technical scheme of the embodiment of the invention solves the technical problem of higher development and maintenance cost in the prior art that the data processing engine accesses the database, realizes that the data processing engine can access the database through a small amount of codes, and achieves the technical effect of reducing the development and maintenance cost of the codes.
Optionally, the database access device further includes: and the bridge obtaining device is used for packaging at least one basic class for connecting the database, and taking the packaged result as the self-defined bridge.
Optionally, the database access module 420 is configured to call, through the database connection component of the data processing engine, the predefined custom bridge corresponding to the database connection component to connect to the target database.
Optionally, the database access module 420 is configured to determine a storage path of the predefined custom bridge corresponding to the database connection component; and loading the custom bridge in the storage path into the data processing engine, and calling the custom bridge through a database connecting component of the data processing engine.
Optionally, the database access module 420 is configured to, for each database access instruction, analyze the database access instruction by calling the custom bridge corresponding to the data processing engine to obtain a database name of the target database; generating a first database execution statement for connecting the target database based on the database name; and connecting the target database by executing the first database execution statement.
Optionally, after the connecting the target database, the database access apparatus further includes: the data query module is used for analyzing the data acquisition instruction received by the data processing engine by calling the custom bridge to generate a second database execution statement for acquiring data in the target database; and executing the second database execution statement by calling a data acquisition component of the data processing engine, and acquiring query data corresponding to the second database execution statement from the target database.
Optionally, after the obtaining of the query data corresponding to the second database execution statement from the target database, the database access apparatus further includes: and the data storage module is used for mapping the query data to a pre-created data table so as to enable the data table to store the query data.
The database access device provided by the embodiment of the invention can execute the database access method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
It should be noted that, the units and modules included in the database access device are merely divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the embodiment of the invention.
EXAMPLE five
FIG. 5 illustrates a schematic diagram of an electronic device 10 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 5, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, and the like, wherein the memory stores a computer program executable by the at least one processor, and the processor 11 can perform various suitable actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from a storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data necessary for the operation of the electronic apparatus 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
A number of components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, or the like; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, or the like. The processor 11 performs the various methods and processes described above, such as database access methods.
In some embodiments, the database access method may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the database access method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the database access method by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be performed. A computer program can execute entirely on a machine, partly on a machine, as a stand-alone software package partly on a machine and partly on a remote machine or entirely on a remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome.
It should be understood that various forms of the flows shown above, reordering, adding or deleting steps, may be used. For example, the steps described in the present invention may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired results of the technical solution of the present invention can be achieved.
The above-described embodiments should not be construed as limiting the scope of the invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A database access method, comprising:
receiving at least one database access instruction based on a data processing engine;
responding to the database access instruction, and connecting a target database by calling a self-defined bridge which is predefined to correspond to the data processing engine so as to access the target database.
2. The method of claim 1, further comprising:
and packaging at least one basic class for connecting the database, and taking the packaged result as the custom bridge.
3. The method of claim 1, wherein said invoking predefines a custom bridge corresponding to said data processing engine, interfacing with a target database, comprising:
and calling the pre-defined custom bridge corresponding to the database connecting component through the database connecting component of the data processing engine to connect a target database.
4. The method of claim 3, wherein said invoking, by a database connection component of the data processing engine, the custom bridge predefined to correspond to the database connection component, connecting to a target database comprises:
determining a storage path of the predefined custom bridge corresponding to the database connection component;
and loading the custom bridge in the storage path into the data processing engine, and calling the custom bridge through a database connecting component of the data processing engine.
5. The method of claim 1, wherein said invoking predefines a custom bridge corresponding to said data processing engine, interfacing with a target database, comprising:
for each database access instruction, analyzing the database access instruction by calling the custom bridge corresponding to the data processing engine to obtain a database name of the target database;
generating a first database execution statement for connecting the target database based on the database name;
and connecting the target database by executing the first database execution statement.
6. The method of claim 1, wherein after the connecting the target database, the method further comprises:
analyzing the data acquisition instruction received by the data processing engine by calling the custom bridge to generate a second database execution statement for acquiring data in a target database;
and executing the second database execution statement by calling a data acquisition component of the data processing engine, and acquiring query data corresponding to the second database execution statement from the target database.
7. The method of claim 6, wherein after the obtaining query data corresponding to the second database execution statement from the target database, the method further comprises:
and mapping the query data to a pre-created data table so that the data table stores the query data.
8. A database access apparatus, comprising:
the instruction receiving module is used for receiving at least one database access instruction based on the data processing engine;
and the database access module is used for responding to the database access instruction, and connecting a target database by calling a self-defined bridge corresponding to the data processing engine in a predefined manner so as to access the target database.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the database access method of any one of claims 1-7.
10. A computer-readable storage medium storing computer instructions for causing a processor to perform the database method of any one of claims 1-7 when executed.
CN202210843120.2A 2022-07-18 2022-07-18 Database access method and device, electronic equipment and storage medium Pending CN115168358A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210843120.2A CN115168358A (en) 2022-07-18 2022-07-18 Database access method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210843120.2A CN115168358A (en) 2022-07-18 2022-07-18 Database access method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115168358A true CN115168358A (en) 2022-10-11

Family

ID=83495484

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210843120.2A Pending CN115168358A (en) 2022-07-18 2022-07-18 Database access method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115168358A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116522415A (en) * 2023-04-23 2023-08-01 杭州前云数据技术有限公司 System for realizing safe storage and sharing of medical big data

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116522415A (en) * 2023-04-23 2023-08-01 杭州前云数据技术有限公司 System for realizing safe storage and sharing of medical big data
CN116522415B (en) * 2023-04-23 2023-11-07 杭州前云数据技术有限公司 System for realizing safe storage and sharing of medical big data

Similar Documents

Publication Publication Date Title
CN110689268B (en) Method and device for extracting indexes
CN114816578A (en) Method, device and equipment for generating program configuration file based on configuration table
CN115168358A (en) Database access method and device, electronic equipment and storage medium
CN111125064A (en) Method and device for generating database mode definition statement
CN108959294B (en) Method and device for accessing search engine
CN115269431A (en) Interface testing method and device, electronic equipment and storage medium
CN115309730A (en) Data auditing method and device, electronic equipment and storage medium
CN115454971A (en) Data migration method and device, electronic equipment and storage medium
CN113868138A (en) Method, system, equipment and storage medium for acquiring test data
CN117271840B (en) Data query method and device of graph database and electronic equipment
CN115563183B (en) Query method, query device and program product
CN114996557B (en) Service stability determination method, device, equipment and storage medium
CN115329999A (en) Operation and maintenance task processing method, device, platform and storage medium
CN115576977A (en) Data paging query method and device, electronic equipment and storage medium
CN115794555A (en) Service log processing method, device, equipment and storage medium
CN115202791A (en) Method and device for determining first screen loading resource, server and storage medium
CN115983222A (en) EasyExcel-based file data reading method, device, equipment and medium
CN115981657A (en) Code generation method and device, electronic equipment and readable medium
CN115167847A (en) Application log acquisition method, device, equipment and storage medium
CN117520368A (en) Query statement determination method, device, equipment, medium and product
CN115220722A (en) Method, device, equipment and medium for back-end internationalization
CN115587091A (en) Data storage method, device, equipment and storage medium
CN115061664A (en) Object conversion method and device, electronic equipment and storage medium
CN116009847A (en) Code generation method, device, electronic equipment and storage medium
CN114416215A (en) Function calling method and device

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