Database interaction method, device and computer equipment

By using proxy servers and risk strategy assessment methods, the security risks of public accounts in the database were resolved, enabling the tracking and auditing of user interactions and improving database security and server stability.

CN119783163BActive Publication Date: 2025-11-28SHENZHEN BAMBOOCLOUD TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In existing technologies, the use of public privileged accounts in databases poses security risks, as it is impossible to accurately track the specific users who leak sensitive data or perform high-risk operations, thus threatening database security.

Method used

The system obtains the terminal account and interaction commands through the proxy server, identifies the target database and matches the database account, assesses the risk level of the interaction commands using risk strategies, performs the corresponding interaction operations, and records the interaction operation logs.

Benefits of technology

It enables the tracking and auditing of user interactions, facilitating the rapid and accurate identification of specific users in the event of data leaks or high-risk operations, reducing security vulnerabilities, and improving database security and server stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119783163B_ABST
    Figure CN119783163B_ABST
Patent Text Reader

Abstract

The application 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; matching a database account corresponding to the terminal account from a preset database account set of the target database according to the terminal account; wherein a one-to-one corresponding relationship exists between the terminal account and the database account; and performing an interaction operation corresponding to the interaction instruction on the target database by using the database account and the interaction instruction. The method can improve the security of database interaction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the development of big data, the importance of databases is becoming increasingly prominent. To promote teamwork and information sharing, and improve work efficiency and decision-making capabilities, traditional technologies often distribute public privileged database accounts to multiple users, allowing them to store and access data within the database. However, this approach poses security risks. In the event of sensitive data leaks or high-risk interactions, it is often impossible to accurately trace the specific user, thus compromising database security. Summary of the Invention

[0003] Therefore, it is necessary to provide a database interaction method, apparatus, computer device, computer-readable storage medium, and computer program product to address the aforementioned technical problems.

[0004] Firstly, this application provides a database interaction method. The method is applied to a proxy server, which is electrically connected to the database, and the method includes:

[0005] Obtain the terminal account and interaction commands with the database;

[0006] Based on the interaction command, determine the target database corresponding to the interaction command;

[0007] Based on the terminal account, the database account corresponding to the terminal account is obtained by matching from the preset database account set of the target database; wherein, there is a one-to-one correspondence between the terminal account and the database account;

[0008] Using the database account and the interaction command, perform the interaction operation corresponding to the interaction command on the target database.

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

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

[0011] Using a preset risk strategy, the interaction command is risk-assessed to obtain its risk level;

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

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

[0014] The interaction instruction is evaluated using the grammatical sub-strategy; wherein the grammatical sub-strategy is used to evaluate whether the interaction instruction conforms to preset grammatical rules;

[0015] If the interaction instruction conforms to the syntax rules, the risk sub-strategy is used to assess the risk of the interaction instruction and obtain the risk level of the interaction instruction.

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

[0017] Based on the terminal account, a candidate database for the terminal account is obtained by matching from a preset database set;

[0018] Based on the interaction instruction, determine the target database identifier of the interaction instruction;

[0019] The target database is located from the candidate databases based on the target database identifier.

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

[0021] Obtain interactive data packets; wherein, the interactive data packets include terminal accounts and interactive instructions to the database;

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

[0023] Add the database account to the interaction data packet to obtain the target data packet;

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

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

[0026] The terminal account and the records of the interaction operations are stored in a preset log file.

[0027] Secondly, this application also provides a database interaction device. The device includes:

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

[0029] The database determination module is used to determine the target database corresponding to the interaction instruction based on the interaction instruction.

[0030] The account determination module is used to match the database account corresponding to the terminal account from a preset set of database accounts in the target database based on the terminal account; wherein, there is a one-to-one correspondence between the terminal account and the database account;

[0031] The database interaction module is used to perform interactive operations on the target database using the database account and the interaction command.

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

[0033] The account level confirmation submodule is used to match the database account from a preset level set to obtain the level of the database account.

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

[0035] The database interaction submodule is used to perform interactive operations corresponding to the interaction command on the target database using the database account of the target database when the level of the database account reaches the risk level of the interaction command.

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

[0037] A syntax evaluation submodule is used to perform syntax evaluation on the interactive instruction using the syntax sub-strategy; wherein, the syntax sub-strategy is used to evaluate whether the interactive instruction conforms to preset syntax rules;

[0038] The risk assessment submodule is used to assess the risk of the interaction instruction by utilizing the risk sub-strategy, and obtain the risk level of the interaction instruction, provided that the interaction instruction conforms to the syntax rules.

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

[0040] The candidate confirmation submodule is used to match the candidate database of the terminal account from a preset database set based on the terminal account.

[0041] The identification confirmation submodule is used to determine the target database identifier of the interaction instruction based on the interaction instruction;

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

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

[0044] The data packet acquisition submodule is used to acquire interactive data packets; wherein, the interactive data packets include terminal accounts and interactive instructions to the database.

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

[0046] The data packet determination submodule is used to add the database account to the interaction data packet to obtain the target data packet;

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

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

[0049] The logging module is used to store the terminal account and the records of the interaction operations into a preset log file.

[0050] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement a database interaction method as described in any one of the embodiments of this disclosure.

[0051] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the database interaction method as described in any one of the embodiments of this disclosure.

[0052] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the database interaction method as described in any of the embodiments of this disclosure.

[0053] The aforementioned database interaction methods, devices, computer equipment, storage media, and computer program products determine the target database through interaction instructions and the database account through the terminal account. Using the database account and interaction instructions, interactive operations are performed on the target database. The one-to-one correspondence between terminal accounts and database accounts facilitates the tracking and auditing of user interactions, ensuring that in the event of data leakage or high-risk operations, the specific user can be accurately and quickly traced through the database account's interaction records. Simultaneously, using a proxy server for database interaction avoids direct terminal account operations, reducing direct database access and mitigating potential security vulnerabilities. Furthermore, the database account corresponding to the terminal account achieves isolation between different terminal accounts, preventing interference from different terminal accounts using public accounts, improving server stability, and enhancing database security. Attached Figure Description

[0054] Figure 1 This is a diagram illustrating the application environment of a database interaction method in one embodiment.

[0055] Figure 2 This is a flowchart illustrating a database interaction method in one embodiment;

[0056] Figure 3 This is a flowchart illustrating the process of completing interactive operations using a database account in one embodiment.

[0057] Figure 4 This is a flowchart illustrating the risk assessment process for interactive instructions in one embodiment;

[0058] Figure 5 This is a flowchart illustrating the process of determining the target database in one embodiment;

[0059] Figure 6 This is a flowchart illustrating the process of completing an interactive operation using data packets in one embodiment.

[0060] Figure 7 This is a flowchart illustrating the implementation of a database interaction method in one embodiment;

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

[0062] Figure 9 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0063] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0064] The database interaction method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system stores the data that server 104 needs to process. The data storage system can be integrated onto server 104 or located in the cloud or on other network servers. Terminal 102 establishes a connection with server 104 through a terminal account, and server 104 connects to the data storage system to complete the interactive operations requested by terminal 102. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted devices, etc. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.

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

[0066] Step S100: Obtain the terminal account and interaction instructions with the database.

[0067] In one exemplary embodiment, the terminal account may include an account used to identify the interactive user. It is understood that the interactive user 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 one exemplary implementation, the interactive instructions may include interactive instructions that conform to preset rules, wherein the preset rules may include SQL (database) statements, statements using regular expression rules, etc.

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

[0070] Step S200: Determine the target database corresponding to the interaction instruction based on the interaction instruction.

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

[0072] In one exemplary embodiment, the target database may include establishing a connection with the target database, or obtaining the identifier of the target database; for example, the identifier of the database may be a grade XX exam results table, where the identifier is used to refer to a specific database and is not necessarily the table name of the database.

[0073] Step S300: Based on the terminal account, match the database account corresponding to the terminal account from the preset database account set of the target database; wherein, there is a one-to-one correspondence between the terminal account and the database account.

[0074] In one exemplary embodiment, the database account set may include a set of terminal accounts and their corresponding database accounts. That is, the database account corresponding to a terminal account can be found from the set using the terminal account.

[0075] In one exemplary embodiment, the database account can be a temporary account, i.e., an account used for interacting with the target database within a specified time or number of interactions. It is understood that different databases can have different database accounts, and when generating a temporary database account, accounts for multiple target databases that the terminal account needs to interact with can be generated directly. In another exemplary embodiment, when generating a temporary database account, a single account can also be generated directly, and the interaction with the target database can be completed using a single account.

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

[0077] Step S400: Using the database account and the interaction command, perform the interaction operation corresponding to the interaction command on the target database.

[0078] In one exemplary embodiment, it may include establishing a connection with the target database using a database account and completing the corresponding interactive operation according to the interactive instructions; it is understood that the end user's account does not contact the database, but the interaction with the database is completed through a proxy server.

[0079] In the aforementioned database interaction method, the target database is determined through interaction commands, and the database account is identified through the terminal account. Interactive operations are then performed on the target database using the database account and the interaction commands. This one-to-one correspondence between terminal accounts and database accounts facilitates the tracking and auditing of user interactions, ensuring that in the event of data leakage or high-risk operations, the specific user can be accurately and quickly traced through the database account's interaction records. Simultaneously, using a proxy server for database interaction avoids direct terminal account operations, reducing direct database access and mitigating potential security vulnerabilities. Furthermore, the database account corresponding to the terminal account achieves isolation between different terminal accounts, preventing interference from different terminal accounts using public accounts, improving server stability, and enhancing database security.

[0080] In one embodiment, such as Figure 3 As shown, the step of using the database account and the interaction command to perform the interaction operation corresponding to the interaction command on the target database includes:

[0081] Step S401: Using the database account, the level of the database account is obtained by matching from a preset level set.

[0082] In one exemplary embodiment, the level set may include a set of permission levels corresponding to each database account, that is, different users have different permissions for their database accounts. For example, a database may have a company system administrator, project team members, and outsourcing company personnel. The level set may be {system administrator: high level; project team members: medium level; outsourcing company personnel: low level}, etc. It is understood that the level information here may also use numbers to represent levels, and multiple users may have the same level, etc.

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

[0084] Step S402: Using a preset risk strategy, perform a risk assessment on the interactive command to obtain the risk level of the interactive command.

[0085] In one exemplary embodiment, the risk strategy can be used to assess the permission level of interactive instructions; for example, querying the database is "low-level", adding, modifying or deleting some data in the database is "medium-level", and interacting with the core data of the database is "high-level", etc.

[0086] In one exemplary embodiment, the risk assessment may also include the impact of the modified interactive instructions, such as whether there is a database connected to the database. For example, if the data in the database directly affects the data in other databases, then the data in that database can be set to the "high" level. It is 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: If 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 one exemplary embodiment, the database account's level reaching the risk level of the interaction instruction may include the database account's permissions being able to execute the interaction operation corresponding to the risk level of the interaction instruction; it can be understood here that if the database account's level does not reach the risk level of the interaction instruction, the interaction instruction may be interrupted, etc.

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

[0090] In this embodiment, by judging the database account level and the risk level of the interaction command, the interaction operation is completed when the database account level reaches the risk level of the interaction command. This ensures that all database interaction operations are within the database account level range, preventing low-level accounts from performing high-level operations, thereby improving database security.

[0091] In one embodiment, such as Figure 4 As shown, the risk strategy includes a syntax sub-strategy and a risk sub-strategy; the step of using the preset risk strategy to perform a risk assessment on the interactive instruction to obtain the risk level of the interactive instruction includes:

[0092] Step S411: Perform grammatical evaluation on the interactive instruction using the grammatical sub-strategy; wherein the grammatical sub-strategy is used to evaluate whether the interactive instruction conforms to preset grammatical rules.

[0093] In one exemplary embodiment, the syntax sub-policy may include whether the interactive instruction conforms to the syntax rules preset by the proxy server; it is understood that the syntax rules here may include multiple syntax rules, such as SQL (database) language, DDL (Data Definition Language), DML (Data Manipulation Language), etc.

[0094] Step S412: If the interaction instruction conforms to the syntax rules, the risk sub-strategy is used to assess the risk of the interaction instruction and obtain the risk level of the interaction instruction.

[0095] In one exemplary embodiment, the interaction command conforming to the syntax rules may include a database interaction operation that the proxy server can recognize the desired interaction operation of the interaction command. In another exemplary embodiment, different syntax rules can be set for different levels of database accounts to limit the permissions of different levels; specifically, regular expression rules can be used to set different levels of database accounts; for example, low-level accounts can only interact through SQL statements; high-level accounts can interact through specific commands such as "change XX data in XX database to XX".

[0096] In one exemplary embodiment, the risk sub-strategy includes determining the risk level of the interaction command based on the database, the content of the database, and the degree of association between the databases; for example, if the database is a core database, then the interaction of the database is directly set to high level; if the database contains both core data and non-core data, 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 syntax of the interaction command, and under the condition of passing the syntax rules, the risk level of the interaction execution is determined, which can determine that the interaction command conforms to the syntax rules of the proxy server, ensuring the implementation of the interaction command and avoiding server instability caused by the interaction command not conforming to the syntax, thereby improving the stability of the server. At the same time, by intercepting illegal interaction commands input into the database, the security of the database is also ensured.

[0098] In one embodiment, such as Figure 5 As shown, determining the target database corresponding to the interaction instruction based on the interaction instruction includes:

[0099] Step S201: Based on the terminal account, a candidate database for the terminal account is obtained by matching from a preset database set.

[0100] In one exemplary embodiment, the database set may include a collection of all databases; the candidate databases may include databases that the terminal account can interact with, i.e., databases that the terminal account has interaction permissions with. It is understood that some candidate databases may have permissions while others do not, and the terminal account can only interact with data that it has permissions for.

[0101] Step S202: Determine the target database identifier of the interaction instruction based on the interaction instruction.

[0102] In one exemplary embodiment, the database identifier may include identification information of the target database, such as the table name of the database, which describes the name or number of the database. For example, a school may have a database table named "grade", and the database may be called a score database or score database. It is understood that the target database identifier can be obtained from the interaction instructions. Specifically, the data to be interacted with can be obtained from the interaction instructions, thereby obtaining the target database identifier.

[0103] Step S203: Based on the target database identifier, search for the target database from the candidate database.

[0104] In one exemplary embodiment, searching for the target database from the candidate database may include the candidate database and all identifiers of the databases contained in the database set, and the target database can be found using any of the identifiers of the target database.

[0105] In one 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 permission for the database, and the terminal executes the interaction command.

[0106] In this embodiment, candidate databases for a terminal account are determined through the terminal account, and the target database is searched from the candidate databases. This achieves the goal of determining candidate databases under a terminal account through the terminal account, avoiding interaction between the terminal account and non-candidate databases, thereby improving database security.

[0107] In one embodiment, obtaining the terminal account and interaction instructions with the database includes:

[0108] Obtain interactive data packets; wherein the interactive data packets include terminal accounts and interactive instructions to the database.

[0109] In one exemplary embodiment, a data packet containing the terminal account and database interaction instructions can be sent to a proxy server, which will parse the data packet to obtain the terminal account and interaction instructions.

[0110] In one embodiment, such as Figure 6 As shown, the step of using the database account and the interaction command to perform the interaction operation corresponding to the interaction command on the target database includes:

[0111] Step S421: Add the database account to the interaction data packet to obtain the target data packet.

[0112] In one exemplary embodiment, adding a database account to the interaction data packet may include deleting a terminal account from the interaction data packet.

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

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

[0115] In this embodiment, database interaction is completed by acquiring a data packet containing the terminal account and interaction commands, adding the database account to the data packet, and sending it to the database server. This ensures data consistency among different users. Furthermore, sending the data packet to the database server enables rapid interaction with the database, improving the efficiency of database interaction.

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

[0117] The terminal account and the records of the interaction operations are stored in a preset log file.

[0118] In one exemplary embodiment, the terminal account and the record of the interaction operation can be stored in a preset log file. In another exemplary embodiment, the database account and the record of the interaction operation can be stored in a preset log file. It is understood that the terminal account and the database account have a one-to-one correspondence, so the terminal account can be found through the database account.

[0119] In one exemplary embodiment, when sensitive data is leaked 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 terminal account and interaction records in a log file, it is possible to facilitate the tracking and auditing of user interactions, ensuring that the target terminal account can be accurately located in the event of data leakage or high-risk operations in the database, thereby improving the stability of the server and the security of the database.

[0121] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

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

[0123] Users log in to the proxy server using their terminal accounts;

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

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

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

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

[0128] The database account sends 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-risk statements to the data packet and forwards it 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 account.

[0133] Based on the same inventive concept, this application also provides a database interaction device for implementing the database interaction method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations of the one or more database interaction device embodiments provided below can be found in the limitations of the database interaction method described above, and will not be repeated here.

[0134] In one embodiment, such as Figure 8 As shown, a database interaction device 200 is provided, including: 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 acquire the terminal account and interaction instructions with the database;

[0136] The database determination module is used to determine the target database corresponding to the interaction instruction based on the interaction instruction.

[0137] The account determination module is used to match the database account corresponding to the terminal account from a preset set of database accounts in the target database based on the terminal account; wherein, there is a one-to-one correspondence between the terminal account and the database account;

[0138] The database interaction module is used to perform interactive operations on the target database using the database account and the interaction command.

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

[0140] The account level confirmation submodule is used to match the database account from a preset level set to obtain the level of the database account.

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

[0142] The database interaction submodule is used to perform interactive operations corresponding to the interaction command on the target database using the database account of the target database when the level of the database account reaches the risk level of the interaction command.

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

[0144] A syntax evaluation submodule is used to perform syntax evaluation on the interactive instruction using the syntax sub-strategy; wherein, the syntax sub-strategy is used to evaluate whether the interactive instruction conforms to preset syntax rules;

[0145] The risk assessment submodule is used to assess the risk of the interaction instruction by utilizing the risk sub-strategy, and obtain the risk level of the interaction instruction, provided that the interaction instruction conforms to the syntax rules.

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

[0147] The candidate confirmation submodule is used to match the candidate database of the terminal account from a preset database set based on the terminal account.

[0148] The identification confirmation submodule is used to determine the target database identifier of the interaction instruction based on the interaction instruction;

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

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

[0151] The data packet acquisition submodule is used to acquire interactive data packets; wherein, the interactive data packets include terminal accounts and interactive instructions to the database.

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

[0153] The data packet determination submodule is used to add the database account to the interaction data packet to obtain the target data packet;

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

[0155] In one embodiment, the apparatus further includes:

[0156] The logging module is used to store the terminal account and the records of the interaction operations into a preset log file.

[0157] The modules in the aforementioned database interaction device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can invoke and execute the operations corresponding to each module.

[0158] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 9 As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores interactive instruction data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a database interaction method.

[0159] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[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, data stored, data displayed, 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 related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0161] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media 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), magnetic 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. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0162] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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 embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method of interacting with a database, characterized by, The method is applied to a proxy server which is electrically connected with a database, and the method comprises: obtaining a terminal account and an interaction instruction for the database; according to the terminal account, matching a candidate database of the terminal account from a preset database set; determining a target database identifier of the interaction instruction according to the interaction instruction; finding a target database from the candidate database according to the target database identifier; according to the terminal account, matching a database account corresponding to the terminal account from a preset database account set of the target database; wherein the terminal account and the database account have a one-to-one corresponding association relationship; the database account is a temporary account used to limit the interaction time and the interaction times with the target database; matching a level of the database account from a preset level set by using the database account; performing syntax evaluation on the interaction instruction by using a syntax sub-strategy; wherein the syntax sub-strategy is used to evaluate whether the interaction instruction conforms to a preset syntax rule; different levels of the database account are provided with different syntax sub-strategies; in a case where the interaction instruction conforms to the syntax rule, performing risk evaluation on the interaction instruction by using a preset risk sub-strategy to obtain a risk level of the interaction instruction; determining risk levels of different data in a same database based on influence degrees of the different data in the same database; the risk sub-strategy comprises determining the risk level of the interaction instruction according to the database, data of the database, and association degrees of the database; in a case where the level of the database account reaches the risk level of the interaction instruction, performing an interaction operation corresponding to the interaction instruction on the target database by using the database account of the target database.

2. The method of claim 1, wherein, The obtaining of the terminal account and the interaction instruction for the database comprises: obtaining an interaction data packet; wherein the interaction data packet comprises the terminal account and the interaction instruction for the database; the performing of the interaction operation corresponding to the interaction instruction on the target database by using the database account and the interaction instruction comprises: adding the database account into the interaction data packet to obtain a target data packet; sending the target data packet to a database server; wherein the database server is used to complete the interaction operation on the target database.

3. The method of claim 1, wherein, The method further comprises: storing a record of the terminal account and the interaction operation into a preset log file.

4. The method of claim 1, wherein, The risk sub-strategy comprises determining the risk level of the interaction instruction according to the database, the content of the database, and the association degrees of the database.

5. An interactive apparatus for a database, characterized by The device comprises: an instruction obtaining module configured to obtain a terminal account and an interaction instruction for a database; a database determining module configured to match a candidate database of the terminal account from a preset database set according to the terminal account, determine a target database identifier of the interaction instruction according to the interaction instruction, and find a target database from the candidate database according to the target database identifier; An account determining module is configured to match a database account corresponding to the terminal account from a preset database account set of the target database according to the terminal account, wherein the terminal account and the database account have a one-to-one corresponding relationship, and the database account is a temporary account used to limit the interaction time and the interaction times with the target database. A database interaction module is configured to match a level of the database account from a preset level set using the database account, perform syntax evaluation on the interaction instruction using a syntax sub-strategy, wherein the syntax sub-strategy is used to evaluate whether the interaction instruction conforms to a preset syntax rule, different levels of the database account are provided with different syntax sub-strategies, in a case where the interaction instruction conforms to the syntax rule, perform risk evaluation on the interaction instruction using a preset risk sub-strategy to obtain a risk level of the interaction instruction, determine the risk levels of different data in the same database based on the influence degrees of the different data in the same database, the risk sub-strategy includes determining the risk level of the interaction instruction according to the database, the data of the database, and the association degree of the database, and in a case where the level of the database account reaches the risk level of the interaction instruction, perform the interaction operation corresponding to the interaction instruction on the target database using the database account of the target database.

6. The apparatus of claim 5, wherein, The database interaction module further includes: A data packet determining sub-module is configured to add the database account to an interaction data packet to obtain a target data packet. A data packet sending sub-module is configured to send the target data packet to a database server, wherein the database server is used to complete the interaction operation on the target database.

7. The apparatus of claim 5, wherein, The apparatus further includes: A log recording module is configured to store the terminal account and the record of the interaction operation into a preset log file.

8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that, The processor executes the computer program to implement the steps of the method in any one of claims 1 to 4.

9. A computer-readable storage medium having stored thereon a computer program, characterized in that The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 4.

10. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 4.

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