Database interaction method and device and computer equipment

Through the method of matching proxy servers and database accounts, the security risks in traditional database interaction methods are solved, accurate positioning and tracking of database interaction operations are achieved, and database security and server stability are improved.

CN119783163AActive Publication Date: 2025-04-08SHENZHEN BAMBOOCLOUD TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510268459.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-07
Publication Date
2025-04-08
Estimated Expiration
2045-03-07

AI Technical Summary

Technical Problem

Traditional database interaction methods have security risks and cannot accurately track specific users, resulting in a threat to database security.

Method used

Through the proxy server, the terminal account and interaction instructions are obtained, the target database is determined, and the database account corresponding to the terminal account is matched from the preset database account set, and the database account and interaction instructions are used for interactive operations.

Benefits of technology

Accurate location and tracking of database interactions is realized, the security of the database is improved, potential security vulnerabilities are reduced, and the stability of the server is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119783163A_ABST
    Figure CN119783163A_ABST
Patent Text Reader

Abstract

The invention relates to a database interaction method and device, computer equipment, a storage medium and a computer program product. The method comprises the following steps: acquiring a terminal account and an interaction instruction for a database; determining a target database corresponding to the interaction instruction according to the interaction instruction; according to the terminal account number, a database account number corresponding to the terminal account number is obtained through matching from a database account number set preset in the target database; wherein the terminal account and the database account have a one-to-one correspondence association relationship; and performing an interaction operation corresponding to the interaction instruction on the target database by using the database account and the interaction instruction. By adopting the method, the security of database interaction can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of big data technology, and in particular to a database interaction method, apparatus, computer equipment, storage medium and computer program product. Background Art

[0002] With the development of big data, the importance of databases has become increasingly prominent. In order to promote teamwork and information sharing, improve work efficiency and decision-making ability. In traditional technologies, public privileged accounts of databases are usually delivered to multiple users so that multiple users can store and access data in the database. However, this practice has security risks. Once sensitive data is leaked or high-risk interactive operations occur, it is often impossible to accurately track specific users, resulting in threats to the security of the database. Summary of the invention

[0003] Based on this, it is necessary to provide a method, device, computer equipment, computer-readable storage medium and computer program product capable of interacting with a database in order to address the above technical issues.

[0004] In a first aspect, the present application provides a database interaction method. The method is applied to a proxy server, the proxy server is electrically connected to a database, and the method comprises:

[0005] Obtain terminal account and interactive instructions for the database;

[0006] According to the interaction instruction, determining a target database corresponding to the interaction instruction;

[0007] According to the terminal account, a database account corresponding to the terminal account is matched from a database account set preset in the target database; wherein a one-to-one corresponding relationship exists between the terminal account and the database account;

[0008] The database account and the interaction instruction are used to perform an interaction operation corresponding to the interaction instruction on the target database.

[0009] In one embodiment, using the database account and the interaction instruction to perform the interaction operation corresponding to the interaction instruction on the target database includes:

[0010] Using the database account, matching the level of the database account from a preset level set;

[0011] Using a preset risk strategy, a risk assessment is performed on the interaction instruction to obtain a risk level of the interaction instruction;

[0012] When the level of the database account reaches the risk level of the interaction instruction, the database account of the target database is used to perform the interaction operation corresponding to the interaction instruction on the target database.

[0013] In one embodiment, the risk strategy includes a grammar sub-strategy and a risk sub-strategy; the risk assessment of the interaction instruction using the preset risk strategy to obtain the risk level of the interaction instruction includes:

[0014] Using the grammar sub-strategy to perform grammar evaluation on the interaction instruction; wherein the grammar sub-strategy is used to evaluate whether the interaction instruction conforms to the preset grammar rules;

[0015] In the case that the interaction instruction complies with the grammatical rule, the risk sub-strategy is used to perform risk assessment on the interaction instruction to obtain the risk level of the interaction instruction.

[0016] In one embodiment, determining the target database corresponding to the interaction instruction according to the interaction instruction includes:

[0017] According to the terminal account, a candidate database of the terminal account is obtained by matching from a preset database set;

[0018] Determining, according to the interaction instruction, a target database identifier of the interaction instruction;

[0019] According to the target database identifier, the target database is searched from the candidate databases.

[0020] In one embodiment, the step of obtaining the terminal account and the interaction instruction to the database includes:

[0021] Obtaining an interactive data packet; wherein the interactive data packet includes a terminal account and interactive instructions to a database;

[0022] The using the database account and the interaction instruction to perform the interaction operation corresponding to the interaction instruction on the target database includes:

[0023] Adding the database account to the interactive data packet to obtain a target data packet;

[0024] The target data packet is sent to a database server; wherein the database server is used to complete interactive operations on the target database.

[0025] In one embodiment, the method further comprises:

[0026] The terminal account and the record of the interactive operation are stored in a preset log file.

[0027] In a second aspect, the present application also provides a database interaction device. The device comprises:

[0028] The instruction acquisition module is used to obtain the terminal account and the interaction instructions for the database;

[0029] A database determination module, used to determine a target database corresponding to the interaction instruction according to the interaction instruction;

[0030] An account determination module, configured to match the database account corresponding to the terminal account from a database account set preset in the target database according to the terminal account; wherein a one-to-one corresponding relationship exists between the terminal account and the database account;

[0031] The database interaction module is used to use the database account and the interaction instruction to perform the interaction operation corresponding to the interaction instruction on the target database.

[0032] In one embodiment, the database interaction module includes:

[0033] An account level confirmation submodule, used to use the database account to match the level of the database account from a preset level set;

[0034] The instruction level confirmation submodule is used to use a preset risk strategy to perform risk assessment on the interactive instruction to obtain the risk level of the interactive instruction;

[0035] The database interaction submodule is used to use the database account of the target database to perform the interaction operation corresponding to the interaction instruction on the target database when the level of the database account reaches the risk level of the interaction instruction.

[0036] In one embodiment, the instruction level confirmation submodule includes:

[0037] A grammar evaluation submodule, used to perform grammar evaluation on the interaction instruction using the grammar sub-strategy; wherein the grammar sub-strategy is used to evaluate whether the interaction instruction conforms to a preset grammar rule;

[0038] The risk assessment submodule is used to, when the interaction instruction complies with the grammatical rule, use the risk sub-strategy to perform risk assessment on the interaction instruction to obtain the risk level of the interaction instruction.

[0039] In one embodiment, the database confirmation module includes:

[0040] A candidate confirmation submodule, configured to obtain a candidate database of the terminal account from a preset database set according to the terminal account;

[0041] An identification confirmation submodule, used to determine a target database identification of the interaction instruction according to the interaction instruction;

[0042] The database confirmation submodule is used to search for the target database from the candidate databases according to the target database identifier.

[0043] In one embodiment, the instruction acquisition module includes:

[0044] The data packet acquisition submodule is used to acquire an interactive data packet; wherein the interactive data packet includes a terminal account and interactive instructions to a database.

[0045] In one embodiment, the database interaction module includes:

[0046] A data packet determination submodule, used to add the database account to the interactive data packet to obtain a target data packet;

[0047] The data packet sending submodule is used to send the target data packet to the database server; wherein the database server is used to complete the interactive operation on the target database.

[0048] In one embodiment, the device further comprises:

[0049] The log recording module is used to store the records of the terminal account and the interactive operations in a preset log file.

[0050] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the database interaction method as described in any one of the embodiments of the present disclosure is implemented.

[0051] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the database interaction method as described in any one of the embodiments of the present disclosure is implemented.

[0052] In a fifth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the database interaction method as described in any one of the embodiments of the present disclosure is implemented.

[0053] The above-mentioned database interaction method, device, computer equipment, storage medium and computer program product determine the target database through interactive instructions, and determine the database account through terminal accounts, and use database accounts and interactive instructions to perform interactive operations on the target database. Through the one-to-one correspondence between terminal accounts and database accounts, it is convenient to track and audit the interactive operations of users, and ensure that when data leakage or high-risk operations occur in the database, the specific operating user can be accurately and quickly tracked through the interactive records of the database account. At the same time, through the proxy server, the database is interacted with, avoiding the operation of the terminal account on the database, reducing direct access to the database, and reducing potential security vulnerabilities. In addition, through the database account corresponding to the terminal account, the isolation of different terminal accounts is realized, avoiding the interference of different terminal accounts using the public account, improving the stability of the server, and also improving the security of the database. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 An application environment diagram of a database interaction method in one embodiment;

[0055] Figure 2 A schematic diagram of a flow chart of a database interaction method in one embodiment;

[0056] Figure 3 A schematic diagram of a flow chart of completing interactive operations using a database account in one embodiment;

[0057] Figure 4 A schematic diagram of a process of risk assessment of interactive instructions in one embodiment;

[0058] Figure 5 A schematic diagram of a process for determining a target database in one embodiment;

[0059] Figure 6 A schematic diagram of a flow chart of using a data packet to complete an interactive operation in one embodiment;

[0060] Figure 7 A schematic diagram of a flow chart of an implementation of a database interaction method in one embodiment;

[0061] Figure 8 is a structural block diagram of a database interaction device in one embodiment;

[0062] Fig. 9 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0063] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0064] The database interaction method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The terminal 102 establishes a connection with the server 104 through the terminal account, and the server 104 is connected to the data storage system to complete the interactive operation proposed by the terminal 102. Among them, the terminal 102 can be but is not limited to various personal computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.

[0065] In one embodiment, Figure 2 As shown, a database interaction method is provided, comprising the following steps:

[0066] Step S100, obtaining the terminal account and interaction instructions to the database.

[0067] In an exemplary embodiment, the terminal account may include an account for identifying an interactive user. It can be understood that the interactive users here may include database administrators, project team users, outsourcing company personnel, etc.; that is, database administrators, project team users, outsourcing company personnel, etc. may all have terminal accounts.

[0068] In an exemplary implementation, the interaction instruction may include an interaction instruction that complies with a preset rule, wherein the preset rule may include a SQL (database) statement, a statement using a regular expression rule, and the like.

[0069] In an exemplary embodiment, the interaction instruction can be obtained by selecting a page; for example, after logging into a terminal account, an interaction page is generated, and a database and corresponding interaction operations are generated in the interaction page. It can be understood that the proxy server can convert the corresponding interaction operations into interaction instructions.

[0070] Step S200: determining a target database corresponding to the interaction instruction according to the interaction instruction.

[0071] In an exemplary embodiment, the interactive instruction may include B operation on A database; wherein, A database is the identification of the target database, etc., and B may include adding, deleting, modifying, searching, etc. of the database; it can be understood that by using the interactive instruction here, the identification of the database can be obtained, that is, the target database can be determined.

[0072] In an exemplary embodiment, the target database may include establishing a connection with the target database, and may also include obtaining an identifier of the target database, etc.; for example, the identifier of the database may be a table of test scores for XX grade XX times, where the identifier is used to refer to a specific database and is not necessarily the name of a database table.

[0073] Step S300: According to the terminal account, a database account corresponding to the terminal account is matched from a database account set preset in the target database; wherein a one-to-one corresponding relationship exists between the terminal account and the database account.

[0074] In an exemplary embodiment, the database account set may include a set of each terminal account and the corresponding database account, that is, the database account corresponding to the terminal account can be found from the set through the terminal account.

[0075] In an exemplary embodiment, the database account may be a temporary account, that is, to interact with the target database at a specified time or a specified number of times. It is understandable that different databases may have different database accounts, and when generating a database temporary account, multiple target database accounts of the target databases that the terminal account needs to interact with may be directly generated. In another exemplary embodiment, when generating a database temporary account, a single account may also be directly generated, and the interaction with the target database may be completed using the single account.

[0076] In an exemplary embodiment, the database account may include a database user. It is understandable that one database account may have multiple different virtual database users, and the database user corresponds to the terminal account one-to-one, so it can be used to locate a specific actual user.

[0077] Step S400: using the database account and the interaction instruction, perform an interaction operation corresponding to the interaction instruction on the target database.

[0078] In an exemplary embodiment, it may include establishing a connection with a target database using a database account and completing corresponding interactive operations according to interactive instructions; it is understandable that the terminal user's account does not contact the database, but rather completes the interaction with the database using a proxy server.

[0079] In the above database interaction method, the target database is determined by the interaction instruction, and the database account is determined by the terminal account, and the target database is interactively operated by using the database account and the interaction instruction. The one-to-one correspondence between the terminal account and the database account provides convenience for tracking and auditing the interactive operations of users, ensuring that when data leakage or high-risk operations occur in the database, the specific operating user can be accurately and quickly tracked through the interaction records of the database account. At the same time, the database is interacted with through the proxy server, avoiding the operation of the database by the terminal account, reducing direct access to the database, and reducing potential security vulnerabilities. In addition, through the database account corresponding to the terminal account, the isolation of different terminal accounts is realized, avoiding the interference of different terminal accounts using the public account, improving the stability of the server, and also improving the security of the database.

[0080] In one embodiment, Figure 3 As shown, the use of the database account and the interaction instruction to perform the interaction operation corresponding to the interaction instruction on the target database includes:

[0081] Step S401, using the database account, matching and obtaining the level of the database account from a preset level set.

[0082] In an exemplary embodiment, the level set may include a permission level set corresponding to each database account, that is, different users' database accounts have different permissions. For example, a database may have company system administrators, project team members, and outsourcing company personnel, where the level set may be {system administrator: senior; project team members: intermediate; outsourcing company personnel, low}, etc.; it can be understood that the level information here can also use numbers to represent the level, and there can be multiple users at the same level, etc.

[0083] In another exemplary embodiment, the level of the database account can also be used to characterize the level of a specific database; for example, the level of database account A for database a is high, while the level of database account A for database b is low; in another exemplary embodiment, the level can also include permission information of the database account, for example, database account A can add and query the database; cannot delete or modify the database, etc.

[0084] Step S402: Using a preset risk strategy, a risk assessment is performed on the interaction instruction to obtain a risk level of the interaction instruction.

[0085] In an exemplary embodiment, the risk strategy can be used to evaluate the permission level of interactive instructions; for example, querying the database is "low level", adding, modifying, and deleting part of the database data is "intermediate level", and interacting with the core data of the database is "high level", etc.

[0086] In an exemplary embodiment, the risk assessment may also include the impact caused by the modification of the interactive instruction, for example, whether there is a database connected to the database, for example, the data existing in the database directly affects the data in other databases, then the data in the database can be set to the "advanced" level; it can be understood that the risk level of different data in the same database can be determined based on the degree of influence of different data in the same database.

[0087] Step S403: When the level of the database account reaches the risk level of the interaction instruction, the database account of the target database is used to perform the interaction operation corresponding to the interaction instruction on the target database.

[0088] In an exemplary embodiment, the level of the database account reaching the risk level of the interaction instruction may include the authority of the database account to perform interaction operations of the risk level corresponding to the interaction instruction; it can be understood here that when the level of the database account does not reach the risk level of the interaction instruction, the interaction instruction can be interrupted, etc.

[0089] In an exemplary embodiment, using the database account of the target database may include using the database account to establish a connection with the target database, and performing interactive operations corresponding to the interactive instructions on the target database; it can be understood that the interactive execution here may include different interactive instructions, not limited to interactive instructions that can be recognized by the database; the proxy server will convert the different interactive instructions into interactive instructions that can be recognized by the database, and perform corresponding operations on the target database.

[0090] In this embodiment, by judging the level of the database account and the risk level of the interactive instruction, the interactive operation is completed when the database account level reaches the interactive instruction risk level. The interactive operations that can reach the database are all within the database account level range, avoiding low-level accounts from performing high-level operations, thereby improving the security of the database.

[0091] In one embodiment, Figure 4 As shown, the risk strategy includes a grammar sub-strategy and a risk sub-strategy; the risk assessment of the interaction instruction using the preset risk strategy to obtain the risk level of the interaction instruction includes:

[0092] Step S411, using the grammar sub-strategy to perform grammar evaluation on the interaction instruction; wherein the grammar sub-strategy is used to evaluate whether the interaction instruction complies with preset grammar rules.

[0093] In an exemplary embodiment, the grammar sub-strategy may include whether the interaction instruction complies with the grammar rules preset by the proxy server; it can be understood that the grammar rules here may include multiple grammar rules, for example, SQL (database) language, DDL (Data Definition Language), DML (Data Manipulation Language), etc.

[0094] Step S412: When the interaction instruction complies with the grammatical rule, the risk sub-strategy is used to perform risk assessment on the interaction instruction to obtain the risk level of the interaction instruction.

[0095] In an exemplary embodiment, the interaction instruction conforming to the grammatical rule may include that the proxy server can identify the database interaction operation desired by the interaction instruction. In another exemplary embodiment, different grammatical rules may be set for database accounts of different levels to limit permissions of different levels; specifically, regular expression rules may be used to set database accounts of different levels; for example, low-level accounts can only interact through SQL statements; high-level accounts can interact by specifically "changing XX data in XX database to XX", etc.

[0096] In an exemplary embodiment, the risk sub-strategy includes determining the risk level of the interaction instruction based on the database, the content of the database, and the degree of association of the database; for example, if the database is a core database, then the interaction of the database is directly set to high level; if there is both core data and non-core data in the content of the database, then the interaction of the core data of the database can be set to high level, and the interaction of the non-core data can be set to medium level, etc.

[0097] In this embodiment, by judging the grammar of the interaction instructions and judging the risk level of the interaction execution according to the grammatical rules, it is possible to determine whether the interaction instructions comply with the grammatical rules of the proxy server, thereby ensuring the implementation of the interaction instructions and avoiding instability of the server due to grammatical non-compliance of the interaction instructions, thereby improving the stability of the server. At the same time, illegal interaction instructions input into the database are intercepted to ensure the security of the database.

[0098] In one embodiment, Figure 5 As shown, the determining, according to the interaction instruction, a target database corresponding to the interaction instruction includes:

[0099] Step S201: According to the terminal account, a candidate database of the terminal account is matched from a preset database set.

[0100] In an exemplary embodiment, the database set may include a set of all databases; the candidate database may include databases that the terminal account can use to interact, that is, databases that the terminal account has interaction permissions for. It is understandable that some of the candidate databases may have permissions and some may not have permissions, and the terminal account can only interact with the data for which it has permissions.

[0101] Step S202: determining a target database identifier of the interaction instruction according to the interaction instruction.

[0102] In an exemplary embodiment, the database identifier may include identification information of the target database, such as a database table name, which is used to describe the name or number of the database. For example, a database table named "grade" exists in a school, and the name of the database may be called a score database or a score database; it can be understood that the target database identifier can be obtained from the interaction instruction, and specifically, the data to be interacted can be obtained from the interaction instruction, thereby obtaining the target database identifier.

[0103] Step S203: searching the target database from the candidate databases according to the target database identifier.

[0104] In an exemplary embodiment, searching for the target database from the candidate databases may include all identifiers of the candidate databases and the database set, and the target database may be searched for using any identifier of the target database.

[0105] In an exemplary embodiment, if the target database is not found in the candidate database, it indicates that the database does not exist or the database account does not have the interaction authority for the database, and the interaction instruction is terminated.

[0106] In this embodiment, the candidate database of the terminal account is determined through the terminal account, and the target database is searched from the candidate database, so that the candidate database under the terminal account can be determined through the terminal account, avoiding the terminal account from interacting with non-candidate databases, thereby improving the security of the database.

[0107] In one embodiment, the step of obtaining the terminal account and the interaction instruction to the database includes:

[0108] Obtain an interactive data packet; wherein the interactive data packet includes a terminal account and interactive instructions to a database.

[0109] In an exemplary embodiment, a data packet containing a terminal account and a database interaction instruction may be sent to a proxy server, and the proxy server may parse the data packet to obtain the terminal account and the interaction instruction.

[0110] In one embodiment, Figure 6 As shown, the use of the database account and the interaction instruction to perform the interaction operation corresponding to the interaction instruction on the target database includes:

[0111] Step S421, adding the database account to the interactive data packet to obtain a target data packet.

[0112] In an exemplary embodiment, after adding the database account to the interaction data packet, the step of deleting the terminal account in the interaction data packet may include: deleting the terminal account in the interaction data packet.

[0113] Step S422, sending the target data packet to a database server; wherein the database server is used to complete interactive operations on the target database.

[0114] In an exemplary embodiment, a data packet containing a database account and interaction instructions is sent to a database server; it is understandable that the database server can parse the target database and perform interaction operations on the corresponding target database through the database account.

[0115] In this embodiment, by obtaining a data packet containing a terminal account and an interaction instruction, and adding the database account to the data packet and sending it to the database server, the database interaction is completed. The consistency of data between different users is ensured. At the same time, by sending the data packet to the database server, it is possible to quickly interact with the database, thereby improving the efficiency of database interaction.

[0116] In one embodiment, the method further comprises:

[0117] The terminal account and the record of the interactive operation are stored in a preset log file.

[0118] In an exemplary embodiment, the terminal account and the records of interactive operations can be stored in a preset log file. In another exemplary embodiment, the database account and the records of interactive operations can be stored in a preset log file. It can be understood that the terminal account and the database account are in a one-to-one correspondence, so the terminal account can be found through the database account.

[0119] In an exemplary embodiment, when sensitive data leakage or high-risk interactive operations occur, the specific user can be quickly and accurately tracked through the log file.

[0120] In this embodiment, by storing the records of terminal accounts and interactive operations in log files, it is possible to facilitate the tracking and auditing of user interactions, ensuring that when data leakage or high-risk operations occur in the database, the target terminal account can be accurately located, thereby improving the stability of the server and the security of the database.

[0121] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0122] In an exemplary embodiment, the method may be as follows Figure 7 The method implementation shown includes:

[0123] The user logs in to the proxy server through the terminal account;

[0124] The proxy server parses the data packet of the terminal account to obtain the target database identifier and the terminal account;

[0125] The proxy server sends the target database identifier and the terminal account to the database;

[0126] The database returns the target database user name to the proxy server;

[0127] The proxy server modifies the data packet and changes the terminal account in the data packet to the database account;

[0128] Use the database account to send a login request to the database server, and the database server responds to the request;

[0129] The proxy server records the terminal account and responds to the user;

[0130] The user sends an execution statement to the proxy server;

[0131] The proxy server blocks illegal and high-risk statements, then adds legal and non-risky statements to the data packet and forwards them to the database server, and sends audit messages to the audit module;

[0132] The audit module records the audit content of the interactive operations of the terminal accounts.

[0133] Based on the same inventive concept, the embodiment of the present application also provides a database interaction device for implementing the database interaction method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of one or more database interaction devices provided below can refer to the limitations of the database interaction method above, and will not be repeated here.

[0134] In one embodiment, Figure 8 As shown, a database interaction device 200 is provided, comprising: an instruction acquisition module 201, a database determination module 202, an account determination module 203, and a database interaction module 204, wherein:

[0135] The instruction acquisition module is used to obtain the terminal account and the interaction instructions for the database;

[0136] A database determination module, used to determine a target database corresponding to the interaction instruction according to the interaction instruction;

[0137] An account determination module, configured to match the database account corresponding to the terminal account from a database account set preset in the target database according to the terminal account; wherein there is a one-to-one corresponding relationship between the terminal account and the database account;

[0138] The database interaction module is used to use the database account and the interaction instruction to perform the interaction operation corresponding to the interaction instruction on the target database.

[0139] In one embodiment, the database interaction module includes:

[0140] An account level confirmation submodule, used to use the database account to match the level of the database account from a preset level set;

[0141] The instruction level confirmation submodule is used to use a preset risk strategy to perform risk assessment on the interactive instruction to obtain the risk level of the interactive instruction;

[0142] The database interaction submodule is used to use the database account of the target database to perform the interaction operation corresponding to the interaction instruction on the target database when the level of the database account reaches the risk level of the interaction instruction.

[0143] In one embodiment, the instruction level confirmation submodule includes:

[0144] A grammar evaluation submodule, used to perform grammar evaluation on the interaction instruction using the grammar sub-strategy; wherein the grammar sub-strategy is used to evaluate whether the interaction instruction conforms to a preset grammar rule;

[0145] The risk assessment submodule is used to, when the interaction instruction complies with the grammatical rule, use the risk sub-strategy to perform risk assessment on the interaction instruction to obtain the risk level of the interaction instruction.

[0146] In one embodiment, the database confirmation module includes:

[0147] A candidate confirmation submodule, configured to obtain a candidate database of the terminal account from a preset database set according to the terminal account;

[0148] An identification confirmation submodule, used to determine a target database identification of the interaction instruction according to the interaction instruction;

[0149] The database confirmation submodule is used to search for the target database from the candidate databases according to the target database identifier.

[0150] In one embodiment, the instruction acquisition module includes:

[0151] The data packet acquisition submodule is used to acquire an interactive data packet; wherein the interactive data packet includes a terminal account and interactive instructions to a database.

[0152] In one embodiment, the database interaction module includes:

[0153] A data packet determination submodule, used to add the database account to the interactive data packet to obtain a target data packet;

[0154] The data packet sending submodule is used to send the target data packet to the database server; wherein the database server is used to complete the interactive operation on the target database.

[0155] In one embodiment, the device further comprises:

[0156] The log recording module is used to store the records of the terminal account and the interactive operations in a preset log file.

[0157] Each module in the above-mentioned database interaction device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0158] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig. 9 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store interactive instruction data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a database interaction method is implemented.

[0159] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0160] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0161] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0162] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0163] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A database interaction method, characterized in that: The method is applied to a proxy server, the proxy server is electrically connected to a database, and the method comprises: Obtain terminal account and interactive instructions for the database; According to the interaction instruction, determining a target database corresponding to the interaction instruction; According to the terminal account, a database account corresponding to the terminal account is matched from a database account set preset in the target database; wherein a one-to-one corresponding relationship exists between the terminal account and the database account; The database account and the interaction instruction are used to perform an interaction operation corresponding to the interaction instruction on the target database.

2. The method according to claim 1, characterized in that The using the database account and the interaction instruction to perform the interaction operation corresponding to the interaction instruction on the target database includes: Using the database account, matching the level of the database account from a preset level set; Using a preset risk strategy, a risk assessment is performed on the interaction instruction to obtain a risk level of the interaction instruction; When the level of the database account reaches the risk level of the interaction instruction, the database account of the target database is used to perform the interaction operation corresponding to the interaction instruction on the target database.

3. The method according to claim 2, characterized in that The risk strategy includes a grammar sub-strategy and a risk sub-strategy; The using of a preset risk strategy to perform risk assessment on the interaction instruction to obtain the risk level of the interaction instruction includes: Using the grammar sub-strategy to perform grammar evaluation on the interaction instruction; wherein the grammar sub-strategy is used to evaluate whether the interaction instruction conforms to the preset grammar rules; In the case that the interaction instruction complies with the grammatical rule, the risk sub-strategy is used to perform risk assessment on the interaction instruction to obtain the risk level of the interaction instruction.

4. The method according to claim 1, characterized in that: The step of determining, according to the interaction instruction, a target database corresponding to the interaction instruction includes: According to the terminal account, a candidate database of the terminal account is obtained by matching from a preset database set; Determining, according to the interaction instruction, a target database identifier of the interaction instruction; According to the target database identifier, the target database is searched from the candidate databases.

5. The method according to claim 1, characterized in that The obtaining of the terminal account and the interaction instruction to the database includes: Obtaining an interactive data packet; wherein the interactive data packet includes a terminal account and interactive instructions to a database; The using the database account and the interaction instruction to perform the interaction operation corresponding to the interaction instruction on the target database includes: Adding the database account to the interactive data packet to obtain a target data packet; The target data packet is sent to a database server; wherein the database server is used to complete interactive operations on the target database.

6. The method according to claim 1, characterized in that The method further comprises: The terminal account and the record of the interactive operation are stored in a preset log file.

7. A database interaction device, characterized in that: The device comprises: The instruction acquisition module is used to obtain the terminal account and the interaction instructions for the database; A database determination module, used to determine a target database corresponding to the interaction instruction according to the interaction instruction; An account determination module, configured to match the database account corresponding to the terminal account from a database account set preset in the target database according to the terminal account; wherein there is a one-to-one corresponding relationship between the terminal account and the database account; The database interaction module is used to use the database account and the interaction instruction to perform the interaction operation corresponding to the interaction instruction on the target database.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • SQL statement detection method and device, terminal equipment and storage medium

    CN112948415A

  • Service access processing method and device, computer readable medium and electronic equipment

    CN115203670A

  • Database auditing method and device based on cloud access security agent

    CN115203712A