Database connection method and device, computer equipment and storage medium
Through the proxy server using the target database identification and request logo to obtain and encrypted the database account account and password, the existing database security threat and performance decline were solved, and high security and reliability database connections were realized.
Patent Information
- Application Number
- CN202411908972.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-01-24
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing databases face security threats such as over-rights use, abuse of permissions, abnormal access and illegal operations. As the number of databases grows, the number of triggers required increases, resulting in a decline in database performance.
Get the client's connection request for the target database through the proxy server, use the target database identification and randomly generated request logo to obtain the database account and password, and encrypt the information through encryption strategies to establish the connection.
Enhance the security and reliability of the connection request, ensure the uniqueness of each connection request, and fail when the client account exits, avoids the leakage of the account and password, and improves the security of the system.
Smart Images

Figure CN119357272A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data technology, and in particular to a database connection method, device, computer equipment, storage medium and computer program product. Background Art
[0002] With the development of database technology, security and standardization are receiving more and more attention. As the core asset of an enterprise, data is of vital importance to management departments. However, current databases generally face security threats such as unauthorized use, abuse of authority, abnormal access, and illegal operations. To address these issues, existing technologies usually transform each database and add triggers to monitor the interaction between accounts and databases. However, as the number of databases continues to grow, the number of triggers required is also increasing, which will cause a significant decrease in database performance when multiple triggers are triggered at the same time. Summary of the invention
[0003] Based on this, it is necessary to provide a database connection method, device, computer equipment, computer readable storage medium and computer program product to address the above technical problems.
[0004] In a first aspect, the present application provides a database connection method. Applied to a proxy server; the proxy server is electrically connected to a client and a database server; the method comprises:
[0005] In response to a connection request from an account on a client to a target database, obtaining a target database identifier, a request address, and a request identifier in the connection request; wherein the request identifier is randomly generated in response to a login operation of the account to the client; when the account logs out of the client operation, the request identifier becomes invalid;
[0006] In the case where the request address matches the address of the proxy server, using the target database identifier and the request identifier, obtaining the account and password of the target database corresponding to the target database identifier;
[0007] Use the account number and password to establish a connection with the target database.
[0008] In one embodiment, the step of using the target database identifier and the request identifier to obtain the account and password of the target database corresponding to the target database identifier includes:
[0009] Using the target database identifier and the request identifier, obtain an initial account and an initial password of the target database corresponding to the target database identifier;
[0010] Using the initial account, initial password and request identifier, send a connection request to the database server;
[0011] The encryption policy sent by the database server is obtained, and the initial account and initial password are encrypting by using the encryption policy to obtain the account and password of the target database corresponding to the target database identifier.
[0012] In one embodiment, the step of encrypting the initial account and the initial password by using the encryption strategy to obtain the account and password of the target database corresponding to the target database identifier includes:
[0013] Encrypting the initial account and initial password using the encryption strategy to obtain an encrypted account and encrypted password;
[0014] The encrypted account number and the encrypted password are identified by using a preset hash strategy to obtain the account number and password of the target database corresponding to the target database identifier.
[0015] In one embodiment, the obtaining the encryption policy sent by the database server and encrypting the initial account and initial password using the encryption policy to obtain the account and password of the target database corresponding to the target database identifier includes:
[0016] Obtaining the encryption strategy and encryption coefficient sent by the database server; wherein the encryption coefficient is obtained by randomly generating;
[0017] The initial account number, initial password and encryption coefficient are encrypted using the encryption strategy to obtain the account number and password of the target database corresponding to the target database identifier.
[0018] In one embodiment, the use of the account and password to establish a connection with the target database includes:
[0019] Using the account number, password and request identifier, a connection is established with the target database; wherein, if the request identifier is invalid, the connection request is cancelled.
[0020] In one embodiment, after establishing a connection with the target database using the account and password, the method further includes:
[0021] Obtain the data encryption policy of the target database;
[0022] In response to an interaction request of an account for data in the target database, encrypt the interaction request using the data encryption policy to obtain a target interaction request;
[0023] The target interaction request is used to perform an interactive operation on the data in the target database.
[0024] In a second aspect, the present application also provides a database connection device. Applied to a proxy server; the proxy server is electrically connected to a client and a database server; the device comprises:
[0025] A data acquisition module, configured to respond to a connection request from an account on a client to a target database, and acquire a target database identifier, a request address, and a request identifier in the connection request; wherein the request identifier is randomly generated in response to a login operation of the account to the client; and when the account logs out of the client, the request identifier becomes invalid;
[0026] An account and password acquisition module, configured to acquire the account and password of the target database corresponding to the target database identifier by using the target database identifier and the request identifier when the request address matches the address of the proxy server;
[0027] The database connection module is used to establish a connection with the target database using the account and password.
[0028] In one embodiment, the account and password acquisition module includes:
[0029] An account and password acquisition submodule, used to acquire an initial account and an initial password of a target database corresponding to the target database identifier by using the target database identifier and the request identifier;
[0030] A connection request submodule, used to send a connection request to the database server using the initial account, initial password and request identifier;
[0031] The account and password encryption submodule is used to obtain the encryption policy sent by the database server, and use the encryption policy to encrypt the initial account and initial password to obtain the account and password of the target database corresponding to the target database identifier.
[0032] In one embodiment, the account and password encryption submodule includes:
[0033] An account and password encryption unit, used to encrypt the initial account and initial password using the encryption strategy to obtain an encrypted account and encrypted password;
[0034] The account and password identification unit is used to identify the encrypted account and the encrypted password by using a preset hash strategy to obtain the account and password of the target database corresponding to the target database identifier.
[0035] In one embodiment, the account and password encryption submodule includes:
[0036] A policy acquisition unit, used to acquire the encryption policy and encryption coefficient sent by the database server; wherein the encryption coefficient is obtained by random generation;
[0037] The account and password encryption unit is used to encrypt the initial account, initial password and encryption coefficient by using the encryption strategy to obtain the account and password of the target database corresponding to the target database identifier.
[0038] In one embodiment, the database connection module is further used for:
[0039] Using the account number, password and request identifier, a connection is established with the target database; wherein, if the request identifier is invalid, the connection request is cancelled.
[0040] In one embodiment, the device further comprises:
[0041] A policy acquisition module is used to obtain the data encryption policy of the target database;
[0042] An interaction request module, configured to respond to an interaction request of an account for data in the target database, encrypt the interaction request using the data encryption strategy, and obtain a target interaction request;
[0043] The data interaction module is used to perform interactive operations on the data in the target database using the target interaction request.
[0044] 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 connection method as described in any one of the embodiments of the present disclosure is implemented.
[0045] 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 connection method as described in any one of the embodiments of the present disclosure is implemented.
[0046] In a fifth aspect, the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the method for connecting to a database as described in any one of the embodiments of the present disclosure is implemented.
[0047] The connection method, device, computer equipment, storage medium and computer program product of the above database, the proxy server obtains the database identifier, request address and request identifier of the connection request, and when the request address matches the address of the proxy server, uses the database identifier and request identifier to obtain the account and password of the database to be requested, and uses the database account and password to establish a connection with the target database. The proxy server enhances the security and reliability of the connection request. The random generation of the request identifier ensures the uniqueness of each connection request, and the request identifier becomes invalid when the client account exits, further protecting the request identifier from being abused. At the same time, through the proxy server, the client cannot obtain the account and password of the database, thereby avoiding illegal interaction caused by the leakage of the account and password, and improving the security of the system. In addition, the matching mechanism of the proxy server effectively prevents connection requests from non-proxy servers, ensuring that only authorized clients can access the database through the proxy server, further improving the security of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] FIG1 is a schematic diagram of a flow chart of a method for connecting to a database in one embodiment;
[0049] FIG2 is a schematic diagram of a first process of obtaining an account and a password in one embodiment;
[0050] FIG3 is a schematic diagram of a second process for obtaining an account and a password in one embodiment;
[0051] FIG4 is a schematic diagram of a third process of obtaining an account and a password in one embodiment;
[0052] FIG5 is a schematic diagram of a process of interacting with a database in one embodiment;
[0053] FIG6 is an application scenario diagram of a database connection method in one embodiment;
[0054] FIG7 is a structural block diagram of a database connection device in one embodiment;
[0055] FIG. 8 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0056] 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.
[0057] In one embodiment, as shown in FIG1 , a database connection method is provided, which is applied to a proxy server; the proxy server is electrically connected to a client and a database server. This embodiment uses the method applied to a server as an example for illustration. It is understandable that the method can also be applied to a terminal, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0058] Step S100, in response to a connection request from an account on a client to a target database, obtain a target database identifier, a request address, and a request identifier in the connection request; wherein the request identifier is randomly generated in response to a login operation of the account to the client; when the account exits the client operation, the request identifier becomes invalid.
[0059] In an exemplary embodiment, the target database identifier may include the name of a database to be connected, etc. The target database identifier may be used to specify a database to be connected to an account, etc.
[0060] In an exemplary embodiment, the request address may include inputting an address required to connect to a database, etc.; specifically, the address of a client, the address of a proxy server, etc. may be input.
[0061] In an exemplary embodiment, the request identifier may include randomly generating characters to obtain a request identifier when an account logs in to a client, and the request identifier becomes invalid when the client logs out of the account. It is understandable that when the request identifier becomes invalid, connection to a database cannot be achieved using the request identifier, etc.; in actual use, when the request identifier is leaked, the request identifier will become unavailable due to the client logging out of the account, and a random request identifier will be regenerated the next time the account logs in to the client. The regenerated request identifier here is inconsistent with the previous request identifier, etc., that is, a request identifier is randomly generated for each login and becomes invalid after logging out. In this way, a single use of the request identifier is achieved, avoiding illegal intrusion into the database caused by the leakage of the request identifier.
[0062] In an exemplary embodiment, the request identifier may be used only once, that is, after being used once, the request identifier becomes invalid, etc. Specifically, it may coexist with the invalidation of the exiting client account, that is, the request identifier may become invalid when the request identifier is used or the client account is exited.
[0063] Step S200, when the request address matches the address of the proxy server, using the target database identifier and the request identifier, obtain the account and password of the target database corresponding to the target database identifier.
[0064] In an exemplary embodiment, the request address may include the address of the client, the address of the proxy server, etc.; the request address may be input simultaneously when generating the connection request, etc. In the case where the request address is the address of the proxy server, the subsequent steps are performed, and in the case where the request address is not the address of the proxy server, the connection is terminated. It can be understood that in this way, the database server can only interact with the proxy server, avoiding the interaction between the client and the database server, etc.
[0065] In an exemplary embodiment, using the target database identifier and the request identifier, obtaining the account and password of the target database corresponding to the target database identifier may include first determining whether the request identifier is available, and if the request identifier is available, obtaining the corresponding database account and password according to the target database identifier; in another exemplary embodiment, after determining the request identifier, obtaining the database permission corresponding to the request identifier, determining whether there is permission to connect to the target database corresponding to the target database identifier, and further obtaining the account and password.
[0066] Step S300: Establish a connection with the target database using the account and password.
[0067] In an exemplary embodiment, the proxy server can establish a connection with the target database through an account and password, etc. It can be understood that here the proxy server establishes a connection with the database, and the account can send the data that needs to be interacted to the proxy server through the client, and the proxy server then sends the data that needs to be interacted to the target database, etc.
[0068] In the above database connection method, the proxy server obtains the database identifier, request address and request identifier of the connection request, and when the request address matches the address of the proxy server, uses the database identifier and request identifier to obtain the account and password of the database to be requested, and uses the database account and password to establish a connection with the target database. The proxy server enhances the security and reliability of the connection request. The random generation of the request identifier ensures the uniqueness of each connection request, and the request identifier becomes invalid when the client account exits, further protecting the request identifier from being abused. At the same time, through the proxy server, the client cannot obtain the account and password of the database, thereby avoiding illegal interactions caused by the leakage of the account and password, and improving the security of the system. In addition, the matching mechanism of the proxy server effectively prevents connection requests from non-proxy servers, ensuring that only authorized clients can access the database through the proxy server, further improving the security of the system.
[0069] In one embodiment, as shown in FIG. 2 , the step of obtaining the target database account and password corresponding to the target database identifier by using the target database identifier and the request identifier includes:
[0070] Step S201: using the target database identifier and the request identifier, obtain an initial account and an initial password of the target database corresponding to the target database identifier.
[0071] Step S202: Send a connection request to the database server using the initial account, initial password and request identifier.
[0072] Step S203, obtaining the encryption policy sent by the database server, and using the encryption policy to encrypt the initial account and initial password to obtain the account and password of the target database corresponding to the target database identifier.
[0073] In an exemplary embodiment, using the initial account, initial password and request identifier to send a connection request to the database server may include the database server determining whether the request identifier is available, and further determining an encryption strategy through the initial account and initial password. The proxy server encrypts the initial account and initial password through the encryption strategy to obtain a target account and target password of the database. It is understandable that in this way, in the event that the initial account and initial password are leaked, a connection with the database cannot be established without a request identifier, further improving the security of the system.
[0074] In an exemplary embodiment, the database server may determine the initial account and the initial password to determine whether the initial account and the initial password are correct, and further confirm whether to send an encryption policy to the proxy server.
[0075] In this embodiment, the initial account and initial password of the target database are obtained through the target database identifier and the request identifier, and the encryption strategy sent by the database server is obtained by sending a connection request to the database. The initial account and initial password are encrypted using the encryption strategy to obtain the account and password of the target database. The connection request is sent to the database server through the request identifier, and multiple verifications of the request identifier are realized, which avoids the database being invaded due to the leakage of the initial account and initial password, and further improves the security of the database. The connection request is sent to the database server through the initial account and initial password, and the database server verifies the initial account and initial password, ensuring that the connection request of the client account to the target database has passed the verification of the proxy server, and further improves the security of the database system. At the same time, the initial account and initial password are further encrypted through the encryption strategy, which enhances the security of data transmission, reduces the risk of information leakage, and ensures the safety and reliability of database access.
[0076] In one embodiment, as shown in FIG. 3 , the using the encryption strategy to encrypt the initial account and initial password to obtain the account and password of the target database corresponding to the target database identifier includes:
[0077] Step S211, encrypt the initial account and initial password using the encryption strategy to obtain an encrypted account and encrypted password.
[0078] Step S212: using a preset hash strategy, identifying the encrypted account and the encrypted password to obtain the target database account and password corresponding to the target database identifier.
[0079] In an exemplary embodiment, the hash strategy may include a hash algorithm, etc., that is, the encrypted account and the encrypted password are identified by the hash algorithm to obtain the actual account and the actual password of the target database, etc. It can be understood that the uniqueness of the database account and password is guaranteed by the hash strategy, and at the same time, the security of the database connection is further improved.
[0080] In this embodiment, the initial account and initial password are encrypted to obtain an encrypted account and encrypted password. The encrypted account and encrypted password are identified using a hash strategy to obtain a target account and target password of the target database. By encrypting the initial account and initial password using an encryption strategy to generate an encrypted account and encrypted password, the security of the data can be effectively improved. The preset hash strategy is further applied to identify these encrypted credentials to ensure that the account and password finally obtained are reliably processed. This process not only prevents the credentials from being stolen by malicious attackers during transmission and storage, but also increases the complexity and difficulty of identity authentication, thereby greatly enhancing the overall security of the system.
[0081] In one embodiment, as shown in FIG. 4 , the obtaining the encryption policy sent by the database server and using the encryption policy to encrypt the initial account and initial password to obtain the account and password of the target database corresponding to the target database identifier includes:
[0082] Step S221, obtaining the encryption strategy and encryption coefficient sent by the database server; wherein the encryption coefficient is obtained by random generation.
[0083] Step S222: encrypt the initial account, initial password and encryption coefficient using the encryption strategy to obtain the account and password of the target database corresponding to the target database identifier.
[0084] In an exemplary embodiment, the encryption coefficient may include randomly generated, etc. By utilizing the encryption strategy, the encryption coefficient may be combined with the initial account and initial password to obtain the target account and target password of the target database, etc. In another exemplary embodiment, the encryption coefficient may also be randomly generated, and the connection request may be identified by the encryption coefficient to ensure that the same request cannot be copied or replayed. The encryption strategy may also include adding the encryption coefficient to the initial account and initial password, etc. It is understandable that the uniqueness of each connection is guaranteed by the security factor, so that the data is intercepted during the connection, and the account and password of the database cannot be obtained.
[0085] In this embodiment, the encryption strategy and encryption coefficient sent by the database server are obtained; the initial account and initial password are processed using the encryption strategy and encryption coefficient to obtain the account and password of the target database. The initial account, initial password and encryption coefficient are encrypted using the encryption strategy to ensure that the data will not be easily cracked during the transmission process. The randomly generated encryption coefficient increases the unpredictability, making it difficult for the attacker to recover the valid credentials even if he obtains part of the information. Overall, this method greatly improves the security level of database access and protects data from being leaked.
[0086] In one embodiment, the use of the account and password to establish a connection with the target database includes:
[0087] Using the account number, password and request identifier, a connection is established with the target database; wherein, if the request identifier is invalid, the connection request is cancelled.
[0088] In an exemplary embodiment, when establishing a connection with a target database using an actual account and password, it is still necessary to implement it through a request identifier. By confirming the request identifier again, the leakage of the real account and real password of the database can be avoided, which may lead to illegal intrusion into the database.
[0089] In this embodiment, when using an account and password to connect to the target database, a request identifier needs to be used to establish a connection at the same time. If the request identifier is invalid, the connection request is canceled. This avoids the leakage of the real account and password of the database, which may lead to the intrusion of the database, and further improves the security of the database.
[0090] In one embodiment, as shown in FIG5 , after establishing a connection with the target database using the account and password, the method further includes:
[0091] Step S401, obtaining the data encryption policy of the target database.
[0092] Step S402, in response to the account's interactive request for data in the target database, encrypt the interactive request using the data encryption strategy to obtain a target interactive request.
[0093] Step S403: using the target interaction request, perform an interactive operation on the data in the target database.
[0094] In an exemplary embodiment, the data encryption strategy may include encrypting the data interaction request, etc. For example, encrypting the data interaction statement to obtain the target interaction request, etc. It is understandable that in this way, in the data interaction process, even if the data is leaked, the actual interaction content, etc. cannot be obtained.
[0095] In this embodiment, by obtaining and applying the data encryption policy of the target database to encrypt the interaction request, the security of data during transmission can be effectively protected, sensitive information can be ensured not to be stolen or tampered with, and the reliability and security of database operations can be enhanced.
[0096] In an exemplary embodiment, the database connection method library is applied in the environment shown in FIG6 , and specifically includes a database client, a connection security control service, a protocol parsing, a password safe service, and a database service; wherein the proxy server may include a connection security control service, a protocol parsing, and a password safe service, specifically including:
[0097] The database client sends a connection request to the connection security control service; the connection security control service forwards the connection request to the protocol parser; the protocol parser forwards the authorization ID in the connection request to the password safe service; the password safe service item protocol parser returns the real database account password; the protocol parser calculates the password hash and fills in the login authentication message; the connection security control service sends a connection request to the database service.
[0098] 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.
[0099] Based on the same inventive concept, the embodiment of the present application also provides a database connection device for implementing the database connection method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in the embodiments of the one or more database connection devices provided below can refer to the limitations of the database connection method above, and will not be repeated here.
[0100] In one embodiment, as shown in FIG. 7 , a database connection device 100 is provided, which is applied to a proxy server; the proxy server is electrically connected to a client and a database server; and comprises: a data acquisition module 101, an account and password acquisition module 102 and a database connection module 103, wherein:
[0101] A data acquisition module, configured to respond to a connection request from an account on a client to a target database, and acquire a target database identifier, a request address, and a request identifier in the connection request; wherein the request identifier is randomly generated in response to a login operation of the account to the client; and when the account logs out of the client, the request identifier becomes invalid;
[0102] An account and password acquisition module, configured to acquire the account and password of the target database corresponding to the target database identifier by using the target database identifier and the request identifier when the request address matches the address of the proxy server;
[0103] The database connection module is used to establish a connection with the target database using the account and password.
[0104] In one embodiment, the account and password acquisition module includes:
[0105] An account and password acquisition submodule, used to acquire an initial account and an initial password of a target database corresponding to the target database identifier by using the target database identifier and the request identifier;
[0106] A connection request submodule, used to send a connection request to the database server using the initial account, initial password and request identifier;
[0107] The account and password encryption submodule is used to obtain the encryption policy sent by the database server, and use the encryption policy to encrypt the initial account and initial password to obtain the account and password of the target database corresponding to the target database identifier.
[0108] In one embodiment, the account and password encryption submodule includes:
[0109] An account and password encryption unit, used to encrypt the initial account and initial password using the encryption strategy to obtain an encrypted account and encrypted password;
[0110] The account and password identification unit is used to identify the encrypted account and the encrypted password by using a preset hash strategy to obtain the account and password of the target database corresponding to the target database identifier.
[0111] In one embodiment, the account and password encryption submodule includes:
[0112] A policy acquisition unit, used to acquire the encryption policy and encryption coefficient sent by the database server; wherein the encryption coefficient is obtained by random generation;
[0113] The account and password encryption unit is used to encrypt the initial account, initial password and encryption coefficient by using the encryption strategy to obtain the account and password of the target database corresponding to the target database identifier.
[0114] In one embodiment, the database connection module is further used for:
[0115] Using the account number, password and request identifier, a connection is established with the target database; wherein, if the request identifier is invalid, the connection request is cancelled.
[0116] In one embodiment, the device further comprises:
[0117] A policy acquisition module is used to obtain the data encryption policy of the target database;
[0118] An interaction request module, configured to respond to an interaction request of an account for data in the target database, encrypt the interaction request using the data encryption strategy, and obtain a target interaction request;
[0119] The data interaction module is used to perform interactive operations on the data in the target database using the target interaction request.
[0120] Each module in the above-mentioned database connection device can be implemented in whole or in part by software, hardware or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each of the above modules.
[0121] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG8. 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 via a system bus, and the communication interface is connected to the system bus via 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 request identification 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 via a network connection. When the computer program is executed by the processor, a method for connecting to a database is implemented.
[0122] Those skilled in the art will understand that the structure shown in FIG. 8 is merely a block diagram of a partial 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 shown in the figure, or combine certain components, or have a different arrangement of components.
[0123] 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.
[0124] 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.
[0125] 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.
[0126] 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 connection method, characterized in that: Applicable to proxy servers; The proxy server is electrically connected to the client and the database server; the method comprises: In response to a connection request from an account on a client to a target database, obtaining a target database identifier, a request address, and a request identifier in the connection request; wherein the request identifier is randomly generated in response to a login operation of the account to the client; when the account logs out of the client operation, the request identifier becomes invalid; In the case where the request address matches the address of the proxy server, using the target database identifier and the request identifier, obtaining the account and password of the target database corresponding to the target database identifier; Use the account number and password to establish a connection with the target database.
2. The method according to claim 1, characterized in that The step of using the target database identifier and the request identifier to obtain the account number and password of the target database corresponding to the target database identifier includes: Using the target database identifier and the request identifier, obtain an initial account and an initial password of the target database corresponding to the target database identifier; Using the initial account, initial password and request identifier, send a connection request to the database server; The encryption policy sent by the database server is obtained, and the initial account and initial password are encrypting by using the encryption policy to obtain the account and password of the target database corresponding to the target database identifier.
3. The method according to claim 2, characterized in that The step of encrypting the initial account and the initial password by using the encryption strategy to obtain the account and the password of the target database corresponding to the target database identifier includes: Encrypting the initial account and initial password using the encryption strategy to obtain an encrypted account and encrypted password; The encrypted account number and the encrypted password are identified by using a preset hash strategy to obtain the account number and password of the target database corresponding to the target database identifier.
4. The method according to claim 2, characterized in that: The obtaining of the encryption policy sent by the database server, and using the encryption policy to encrypt the initial account and the initial password to obtain the account and password of the target database corresponding to the target database identifier, includes: Obtaining the encryption strategy and encryption coefficient sent by the database server; wherein the encryption coefficient is obtained by randomly generating; The initial account number, initial password and encryption coefficient are encrypted using the encryption strategy to obtain the account number and password of the target database corresponding to the target database identifier.
5. The method according to claim 1, characterized in that The step of establishing a connection with the target database using the account number and password includes: Using the account number, password and request identifier, a connection is established with the target database; wherein, if the request identifier is invalid, the connection request is cancelled.
6. The method according to claim 1, characterized in that After establishing a connection with the target database using the account and password, the method further includes: Obtain the data encryption policy of the target database; In response to an interaction request of an account for data in the target database, encrypt the interaction request using the data encryption policy to obtain a target interaction request; The target interaction request is used to perform an interactive operation on the data in the target database.
7. A database connection device, characterized in that: Applicable to proxy servers; The proxy server is electrically connected to the client and the database server; the device comprises: A data acquisition module, configured to respond to a connection request from an account on a client to a target database, and acquire a target database identifier, a request address, and a request identifier in the connection request; wherein the request identifier is randomly generated in response to a login operation of the account to the client; and when the account logs out of the client, the request identifier becomes invalid; An account and password acquisition module, configured to acquire the account and password of the target database corresponding to the target database identifier by using the target database identifier and the request identifier when the request address matches the address of the proxy server; The database connection module is used to establish a connection with the target database using the account and password.
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
Authority control method, device and equipment and storage medium
CN111079104A
Database connection method and device, proxy server and medium
CN115203676A
Techniques for data persistence across instances of cloud shell layers
CN116018580A