CN116126914A - Data source access method, device, equipment and storage medium - Google Patents

Data source access method, device, equipment and storage medium Download PDF

Info

Publication number
CN116126914A
CN116126914A CN202310064230.3A CN202310064230A CN116126914A CN 116126914 A CN116126914 A CN 116126914A CN 202310064230 A CN202310064230 A CN 202310064230A CN 116126914 A CN116126914 A CN 116126914A
Authority
CN
China
Prior art keywords
data source
target
service center
configuration service
tenant
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202310064230.3A
Other languages
Chinese (zh)
Other versions
CN116126914B (en
Inventor
王晓峰
胡祥旭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Dongfang Hezhi Data Technology Guangdong Co ltd
Original Assignee
Dongfang Hezhi Data Technology Guangdong Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Dongfang Hezhi Data Technology Guangdong Co ltd filed Critical Dongfang Hezhi Data Technology Guangdong Co ltd
Priority to CN202310064230.3A priority Critical patent/CN116126914B/en
Publication of CN116126914A publication Critical patent/CN116126914A/en
Application granted granted Critical
Publication of CN116126914B publication Critical patent/CN116126914B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24553Query execution of query operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses a data source access method, a device, equipment and a storage medium, wherein the method comprises the following steps: when a database access request sent by a target tenant is received, searching a corresponding target SDK packet from a central warehouse; receiving a client identification number returned by the data source configuration service center when the registration is successful; acquiring data source information corresponding to a target tenant from a data source configuration service center through a target SDK package based on a client identification number, a tenant code of the target tenant, an application service code, a key authentication type and a key; and connecting to a corresponding target database according to the data source information. When receiving a database access request sent by a target tenant, the data source information corresponding to the target tenant, which is acquired from the data source configuration service center according to the target SDK packet, is connected to the corresponding target database, so that the problem that configuration errors are easy to occur when the data source is managed through the configuration file is solved.

Description

Data source access method, device, equipment and storage medium
Technical Field
The present invention relates to the field of computer networks, and in particular, to a method, an apparatus, a device, and a storage medium for accessing a data source.
Background
With the development of the national economic social industry, it is becoming more and more important for the corrugated paper packaging industry to build intelligent factories. In the corrugated paper packaging industry, factory intellectualization can be realized through a corrugated paper packaging internet platform, wherein the corrugated paper packaging internet platform is a cloud platform based on a pass and is a pass management platform for multiple tenants and multiple users, and as the bottom technology of the corrugated paper packaging internet pass platform is based on a java micro-service system development, codes are shared and a data source isolation mode is realized, the isolation of the data source is needed when the corrugated paper packaging internet pass platform is used.
In the existing scheme, the data sources can be managed through configuration files, and the corrugated paper packaging internet saas platform obtains the corresponding data sources according to the configuration files encoded in the corresponding services by tenants, but the configuration files are easy to have configuration errors and other problems when the data sources are configured. Therefore, how to manage the data source of the corrugated paper packaging internet saas platform becomes a problem to be solved urgently.
The foregoing is provided merely for the purpose of facilitating understanding of the technical solutions of the present invention and is not intended to represent an admission that the foregoing is prior art.
Disclosure of Invention
The invention mainly aims to provide a data source access method, a device, equipment and a storage medium, and aims to solve the technical problem that configuration errors are easy to occur when a data source is managed through a configuration file in the prior art.
To achieve the above object, the present invention provides a data source access method, including the steps of:
when receiving a database access request sent by a target tenant, searching a corresponding target SDK package from a central warehouse, wherein the central warehouse stores SDK packages configured for different tenants and used for database access;
sending a registration request to a data source configuration service center, and receiving a client identification number returned by the data source configuration service center when registration is successful;
acquiring data source information corresponding to a target tenant from the data source configuration service center through the target SDK packet based on the client identification number, the tenant code of the target tenant, the application service code, the key authentication type and the key;
and connecting to a corresponding target database according to the data source information.
Optionally, before the step of searching the corresponding target SDK package from the central repository when receiving the database access request sent by the target tenant, the method further includes:
acquiring target programs of different tenants accessing the database;
and packaging the target program into an SDK package through a preset management tool, and storing the SDK package into a central warehouse.
Optionally, before the step of searching the corresponding target SDK package from the central repository when receiving the database access request sent by the target tenant, the method further includes:
configuring a key authentication type and a key;
correspondingly, the step of sending a registration request to the data source configuration service center and receiving the client identification number returned by the data source configuration service center when the registration is successful comprises the following steps:
sending a registration request to a data source configuration service center so that the data source configuration service center can verify based on the key authentication type and the key when receiving the registration request;
and when the verification is successful, receiving the client identification number returned by the data source configuration service center.
Optionally, after the step of connecting to the corresponding target database according to the data source information, the method further includes:
when a data source loading request is received, checking the data source loading request through the target SDK packet, and judging whether the data source needs to be loaded according to a checking result;
if yes, a target data source loading request is sent to the data source configuration service center through the target SDK packet, wherein the target data source loading request carries a target tenant code;
and receiving target data source information corresponding to the target tenant codes returned by the data source configuration service center based on the target data source loading request.
Optionally, the target data source loading request carries a target tenant code, the client identification number and the key authentication type;
the data source configuration service center is used for checking whether the client identification number exists or not when the target data source loading request is received; if yes, carrying out key verification based on the key authentication type; and when the verification passes, returning the target data source information corresponding to the target tenant code.
Optionally, the key authentication type includes: AES symmetric encryption authentication, the key comprising: AES encryption key;
the data source configuration service center is used for decrypting request parameters in the registration request through the AES symmetric encryption authentication and the AES encryption key when the registration request is received; and when the decryption is successful, returning the client identification number.
Optionally, after the step of packaging the program into an SDK package by a preset management tool and storing the SDK package in the central repository, the method further includes:
and acquiring annotation information of the loading-free data source API, and adding the annotation information to the SDK package.
In addition, to achieve the above object, the present invention also proposes a data source access device, the device comprising:
the system comprises an SDK packet searching module, a database access module and a database access module, wherein the SDK packet searching module is used for searching a corresponding target SDK packet from a central warehouse when receiving a database access request sent by a target tenant, and the central warehouse stores the SDK packets configured for different tenants and used for database access;
the registration request sending module is used for sending a registration request to the data source configuration service center and receiving a client identification number returned by the data source configuration service center when the registration is successful;
the data source acquisition module is used for acquiring data source information corresponding to a target tenant from the data source configuration service center through the target SDK packet based on the client identification number, the tenant code of the target tenant, the application service code, the key authentication type and the key;
and the database connection module is used for connecting to the corresponding target database according to the data source information.
In addition, to achieve the above object, the present invention also proposes a data source access device, the device comprising: a memory, a processor, and a data source access program stored on the memory and executable on the processor, the data source access program configured to implement the steps of the data source access method as described above.
In addition, to achieve the above object, the present invention also proposes a storage medium having stored thereon a data source access program which, when executed by a processor, implements the steps of the data source access method as described above.
When a database access request sent by a target tenant is received, searching a corresponding target SDK package from a central warehouse, wherein the central warehouse stores SDK packages configured for different tenants and used for database access; sending a registration request to a data source configuration service center, and receiving a client identification number returned by the data source configuration service center when registration is successful; acquiring data source information corresponding to a target tenant from a data source configuration service center through a target SDK package based on a client identification number, a tenant code of the target tenant, an application service code, a key authentication type and a key; connecting to a corresponding target database according to the data source information; compared with the prior art, when the data source of the pass platform in the corrugated paper packaging industry is managed through the configuration file, the problem of configuration error of the data source of the configuration file is easy to occur.
Drawings
FIG. 1 is a schematic diagram of a data source access device of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a flowchart of a first embodiment of a data source access method according to the present invention;
FIG. 3 is a flowchart illustrating a second embodiment of a data source access method according to the present invention;
FIG. 4 is a flowchart illustrating a third embodiment of a data source access method according to the present invention;
fig. 5 is a block diagram of a first embodiment of a data source access device according to the present invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
Referring to fig. 1, fig. 1 is a schematic diagram of a data source access device of a hardware running environment according to an embodiment of the present invention.
As shown in fig. 1, the data source access device may include: a processor 1001, such as a central processing unit (Central Processing Unit, CPU), a communication bus 1002, a user interface 1003, a network interface 1004, a memory 1005. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a Display, an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may further include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a Wireless interface (e.g., a Wireless-Fidelity (Wi-Fi) interface). The Memory 1005 may be a high-speed random access Memory (Random Access Memory, RAM) or a stable nonvolatile Memory (NVM), such as a disk Memory. The memory 1005 may also optionally be a storage device separate from the processor 1001 described above.
Those skilled in the art will appreciate that the structure shown in fig. 1 is not limiting of the data source access device and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
As shown in fig. 1, an operating system, a network communication module, a user interface module, and a data source access program may be included in the memory 1005 as one type of storage medium.
In the data source access device shown in fig. 1, the network interface 1004 is mainly used for data communication with a network server; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 in the data source access device of the present invention may be disposed in the data source access device, and the data source access device calls the data source access program stored in the memory 1005 through the processor 1001 and executes the data source access method provided by the embodiment of the present invention.
An embodiment of the present invention provides a data source access method, referring to fig. 2, fig. 2 is a schematic flow chart of a first embodiment of the data source access method of the present invention.
In this embodiment, the data source access method includes the following steps:
step S10: when receiving a database access request sent by a target tenant, searching a corresponding target SDK package from a central warehouse, wherein the central warehouse stores SDK packages configured for different tenants and used for database access.
It should be noted that, the execution body of the method of the embodiment may be a data source access device for managing a data source of the boss in the corrugated paper packaging industry, or other data source access systems that can implement the same or similar functions and include the data source access device. The data source access method provided in this embodiment and the following embodiments will be specifically described with a data source access system (hereinafter referred to as a system).
It should be understood that the above-mentioned target tenant may be a tenant or a company applying a boss platform in the corrugated paper packaging industry, where the number of target tenants may be one or more, which is not limited in this embodiment.
It can be appreciated that the database access request may be a request initiated by a tenant or company of the sams platform of the corrugated paper packaging industry for accessing a different database corresponding to the application service.
It should be noted that the central repository may be a repository that stores all resources maintained by a maven team, where maven is a project management tool software that can manage the construction, reporting and documentation of projects through a small piece of descriptive information. In addition, the central repository is managed by maven, and does not need to be configured, but needs to be accessed through a network.
It should be understood that, the target SDK package may be an SDK package for performing the current database access, and since the central repository stores SDK packages configured for different tenants for the database access, when receiving the database access request, the SDK package corresponding to the current access database may be directly searched from the central repository.
In a specific implementation, different tenants can package programs accessing different databases according to applications into SDK packages in a maven mode, the packaged SDK packages are pushed and stored in a central warehouse reaching maven, and when a database access request is received, the corresponding target SDK packages can be directly searched from the central warehouse.
Step S20: and sending a registration request to the data source configuration service center, and receiving a client identification number returned by the data source configuration service center when the registration is successful.
It should be understood that the above-mentioned registration request may be a request sent by the system to the data source configuration service center for whether to register the system to the data source configuration service center, where registering is equivalent to authenticating application information of the system in the data source configuration service center, so that the data source configuration service center really has the application information.
It can be understood that the data source configuration service center can be a platform which is built on the basis of a spring boot framework, a redis database and a mysql database and is used for configuring multi-tenant data source information. The data source configuration service center is configured with basic information and data source information, wherein the basic information comprises: tenant coding, application service coding, read-write separation, database and table separation and the like of the tenant, wherein the data source information comprises: the specific contents included in the basic information and the data source information are not limited in this embodiment.
It should be noted that, the data source configuration service center performs data source configuration to connect to a corresponding database for accessing an application service to a tenant, where different tenants of the same application have different databases, so as to isolate the tenant databases, and the relationship between the basic information and the data source information is one-to-many.
It can be understood that the client identification number may be unique identification information returned by the data source configuration service center when the system is successfully registered in the data source configuration service center.
In a specific implementation, a data source configuration service center can be built based on a spring boot framework, a redis database and a mysql database, at this time, the system can send a registration request to the data source configuration service center to start registration, the data source configuration service center registers a corresponding application service when receiving the registration request, and returns a client identification number to identify the registered application service when the application service is successfully registered, and meanwhile, the returned client identification number can be cached to the local, and if the returned client identification number is a hole, the registration start failure is indicated.
Further, in order to store the SDK package for database access configured for different tenants in the central repository, before the step S10, the method further includes: acquiring target programs of different tenants accessing the database; and packaging the target program into an SDK package through a preset management tool, and storing the SDK package into a central warehouse.
It can be appreciated that the target program can access programs corresponding to different databases for different tenants according to applications.
It should be noted that the preset management tool may be a mavan (project management tool software), or other tools having the same or similar functions as the mavan and used for packaging the program into the SDK package. In practical application, the degree can be packaged into an SDK package through a mavan and pushed to a central warehouse of the mavan, so that an application service in the system can acquire the corresponding SDK package from the central warehouse and integrate the SDK package in a maven or gradle mode.
Step S30: and acquiring data source information corresponding to the target tenant from the data source configuration service center through the target SDK packet based on the client identification number, the tenant code of the target tenant, the application service code, the key authentication type and the key.
It should be understood that, the tenant code of the target tenant may be a number corresponding to the tenant, and different tenants each have a unique corresponding number.
It can be understood that the application service code may be a number corresponding to an application service, and in practical application, different application services have unique corresponding numbers.
It should be noted that, the key authentication type may be a category corresponding to a key that the service center encrypts and decodes data for the system and the data source configuration, for example: token authentication, AES symmetric encryption authentication, and the like. In addition, the key is a parameter which is input in an algorithm for converting plaintext into ciphertext or converting ciphertext into plaintext, and in this embodiment, the key is the parameter which needs to be input for encrypting data or decrypting the encrypted data.
It should be understood that the above data source information may be information such as a driver mode, a connection ip, a connection port, a connection user name, and a connection password corresponding to a target tenant configured by the data source configuration service center, which is not limited in this embodiment.
It can be understood that the data source configuration service center is provided with a visual html configuration page, and corresponding data source information can be configured according to tenant codes and application service codes. In addition, because the loading of the data source in the system may be frequent, in order to alleviate the pressure of accessing the mysql database of the data source configuration service center, redis cache may be introduced, that is, the data source information of the application service corresponding to the tenant may be cached to the redis database, so that the redis database may be preferentially accessed, if the data source information exists, the corresponding data source information may be directly obtained from the redis database, and the data source information of the application service corresponding to the tenant may not be obtained from the mysql database.
In a specific implementation, whether to start registration or not can be configured, an application service code, a key authentication type and a corresponding key are configured, in addition, the URL address of the data source configuration service center needs to be configured to establish connection with the data source configuration service center, after the configuration is completed, a registration request can be sent to the data source configuration service center to start registration, and based on a client identification number returned by the data source configuration service center, a tenant code, an application service code, a key authentication type and a key of a configured target tenant, data source information corresponding to the target tenant is acquired from the data source configuration service center through a target SDK package.
Step S40: and connecting to a corresponding target database according to the data source information.
It may be understood that the target database may be a database accessed by the target tenant according to the application, that is, a database corresponding to the target tenant.
In a specific implementation, firstly, programs corresponding to different databases accessed by different tenants according to applications can be obtained, then the programs are packaged into SDK packages through a mavan, and the SDK packages are stored in a central warehouse. After the application service code, the key authentication type and the corresponding key are configured, a registration request can be sent to a data source configuration service center to start registration, the data source configuration service center registers the corresponding application service after receiving the registration request, returns a client identification number when the registration is successful, searches a corresponding target SDK package from a central warehouse when receiving a database access request sent by a target tenant, and acquires data source information corresponding to the target tenant from the data source configuration service center through the target SDK package based on the tenant code, the application service code, the key authentication type and the key of the target tenant and the client identification number returned by the data source configuration service center, and is connected to the corresponding database according to the acquired data source information, so that a plurality of tenants can realize tenant application data source isolation through connecting the plurality of databases, and manage the data source information through the data source configuration management center.
Further, in order not to access the API through the data source configuration service center, after the step 10, the method further includes: and acquiring annotation information of the loading-free data source API, and adding the annotation information to the SDK package.
It should be noted that, the foregoing no-load data source API may be an application programming interface that does not need to load data source information, and accordingly, annotation information of the no-load data source API is an annotation that acts on the no-load data source API, and is used to define a related description for the no-load data source API.
It should be understood that, after the annotation information of the above-mentioned loading-free data source API is added to the corresponding SDK packet, the API may be accessed directly without going through the data source configuration service center.
The embodiment discloses that when a database access request sent by a target tenant is received, a corresponding target SDK packet is searched from a central warehouse, and the central warehouse stores SDK packets configured for different tenants and used for database access; sending a registration request to a data source configuration service center, and receiving a client identification number returned by the data source configuration service center when registration is successful; acquiring data source information corresponding to a target tenant from a data source configuration service center through a target SDK package based on a client identification number, a tenant code of the target tenant, an application service code, a key authentication type and a key; connecting to a corresponding target database according to the data source information; compared with the prior art, when the data source of the pass platform in the corrugated paper packaging industry is managed through the configuration file, the problem of configuration file data source configuration errors is easy to occur, and when the database access request sent by a target tenant is received, the embodiment searches a corresponding target SDK package from a central warehouse storing SDK packages configured for different tenants and used for database access, and connects data source information corresponding to the target tenant obtained from a data source configuration service center according to the target SDK package to the corresponding target database, so that the technical problem of configuration errors easy to occur when the data source is managed through the configuration file in the prior art is solved.
Referring to fig. 3, fig. 3 is a flowchart illustrating a second embodiment of a data source access method according to the present invention.
Based on the first embodiment, in order to check whether there is a corresponding application in the data source configuration service center, in this embodiment, before step S10, the method further includes:
step S100: the key authentication type and the key are configured.
The key authentication types may include Token authentication, AES symmetric encryption authentication, and the like. In practical application, after the key authentication type and the key are configured, the data or information to be transmitted can be encrypted through the configured key authentication type and key.
The step S20 includes: step S201: and sending a registration request to a data source configuration service center so that the data source configuration service center can verify based on the key authentication type and the key when receiving the registration request.
It should be appreciated that upon receiving the registration request, the data source configuration service center may verify, based on the pre-configured key authentication type and key, whether the application service key and the data source configuration service center have a corresponding application.
It is understood that the key authentication types include: AES symmetric encryption authentication, the key comprising: AES encryption key; the data source configuration service center is used for decrypting request parameters in the registration request through the AES symmetric encryption authentication and the AES encryption key when the registration request is received; and when the decryption is successful, returning the client identification number.
When the key authentication type is AES symmetric encryption authentication, the corresponding key is an AES encryption key, and the data source configuration service center encrypts the request parameter in an AES symmetric encryption manner, decrypts the request parameter in an AES symmetric encryption manner, and passes if decryption is successful. When the key authentication type is Token authentication, the corresponding key is a character string with the length not less than 32 characters, and the validity period can be configured, at the moment, the data source configuration service center can check whether the keys are consistent and judge whether the keys are in the validity period, and if the keys are consistent and in the validity period, the verification is passed.
Step S202: and when the verification is successful, receiving the client identification number returned by the data source configuration service center.
It should be appreciated that after the data source configuration service center verifies through the key authentication type and the key, and the verification is passed, the client identification number corresponding to the application may be returned.
In a specific implementation, the key type can be configured as AES symmetric encryption authentication and a corresponding AES encryption key, and because the data source configuration service center supports application service key authentication, when receiving the registration request, the data source configuration service center can perform verification based on the configured key authentication type and the key, and returns a corresponding client identification number when the verification is successful.
In the embodiment, the registration request is sent to the data source configuration service center by configuring the key authentication type and the key, so that the data source configuration service center checks based on the configured key authentication type and the key when receiving the registration request, and receives the client identification number returned by the data source configuration service center when the check is successful, thereby realizing the registration of the application service to the data source configuration service center.
Referring to fig. 4, fig. 4 is a flowchart of a third embodiment of the data source access method according to the present invention.
Based on the above embodiments, in order to request the data source configuration service center to obtain the data source information of the application service corresponding to the tenant, in this embodiment, after step S10, the method further includes:
step S50: when a data source loading request is received, checking the data source loading request through the target SDK packet, and judging whether the data source needs to be loaded or not according to a checking result.
It should be noted that, the data source loading request may be a signal sent by the tenant to load the data source information of the application service.
It should be appreciated that the target SDK package may verify a data source load request and determine whether the data source needs to be loaded based on the annotation of the data source load request.
Step S60: if yes, a target data source loading request is sent to the data source configuration service center through the target SDK packet, and the target data source loading request carries a target tenant code.
It may be understood that the target data source loading request may be a signal sent to the data source configuration service center for requesting to load data source information, where the target data source loading request carries a target tenant code, and the target tenant code is a number corresponding to a tenant that initiates the data source loading request. In practical application, if the target SDK packet finds that the data source needs to be loaded after analyzing the data source loading request, the target data source loading request carrying the target tenant code may be sent to the data source configuration service center.
Step S70: and receiving target data source information corresponding to the target tenant codes returned by the data source configuration service center based on the target data source loading request.
It should be noted that, the target data source loading request may carry a client identifier and a key authentication type in addition to the target tenant code, and the data source configuration service center checks whether the client identifier exists after receiving the target data source loading request; if yes, carrying out key verification based on the key authentication type; and when the verification passes, returning the target data source information corresponding to the target tenant code.
In a specific implementation, when a system receives a data source loading request, the system can check the data source loading request through a target SDK packet, and judge whether data source information needs to be loaded according to a check result, if the data source needs to be loaded, the target SDK packet can register a client identification number, a target tenant code, an application service code, a key authentication type and a corresponding key returned by the data source configuration service center to the data source service center, so as to request the data source configuration service center to load the data source, after receiving the target data source loading request with the information, the data source configuration service center firstly checks whether the client identification number exists, and checks the key, if the check results are passed, the tenant information which needs to be loaded can be obtained from a redis cache, and returns the obtained data source information, if the corresponding data source information does not exist in the redis cache, the data source information which is obtained from a mysql database can be obtained from the mysql database, and returns the data source information which is obtained from the mysql database, if the data source information which is not corresponding to the data source is not returned, and if the data source information which is not corresponding to the data source is empty is returned to the data source of the data source configuration service center can be judged.
According to the embodiment, when the data source loading request is received, the data source loading request is checked through the target SDK packet, whether the data source needs to be loaded is judged according to the checking result, when the data source needs to be loaded, the target SDK packet is used for sending the target data source loading request carrying the target tenant code to the data source configuration service center, and finally the data source configuration service center is used for receiving target data source information corresponding to the target tenant code returned by the data source configuration service center based on the target data source loading request, so that the data source information of the application service corresponding to the tenant is obtained through the data source configuration service center.
In addition, the embodiment of the invention also provides a storage medium, wherein a data source access program is stored on the storage medium, and the data source access program realizes the steps of the data source access method when being executed by a processor.
Referring to fig. 5, fig. 5 is a block diagram showing the structure of a first embodiment of the data source access apparatus of the present invention.
As shown in fig. 5, a data source access device according to an embodiment of the present invention includes:
the SDK packet searching module 501 is configured to, when receiving a database access request sent by a target tenant, search a corresponding target SDK packet from a central repository, where the central repository stores SDK packets configured for different tenants and used for database access;
a registration request sending module 502, configured to send a registration request to a data source configuration service center, and receive a client identifier returned by the data source configuration service center when registration is successful;
a data source obtaining module 503, configured to obtain, from the data source configuration service center, data source information corresponding to a target tenant through the target SDK packet based on the client identification number, a tenant code, an application service code, a key authentication type, and a key of the target tenant;
and the database connection module 504 is configured to connect to a corresponding target database according to the data source information.
The data source access device of the embodiment discloses that when receiving a database access request sent by a target tenant, a corresponding target SDK package is searched from a central warehouse, and the central warehouse stores SDK packages configured for different tenants and used for database access; sending a registration request to a data source configuration service center, and receiving a client identification number returned by the data source configuration service center when registration is successful; acquiring data source information corresponding to a target tenant from a data source configuration service center through a target SDK package based on a client identification number, a tenant code of the target tenant, an application service code, a key authentication type and a key; connecting to a corresponding target database according to the data source information; compared with the prior art, when the data source of the pass platform in the corrugated paper packaging industry is managed through the configuration file, the problem of configuration file data source configuration errors is easy to occur, and when the database access request sent by a target tenant is received, the embodiment searches a corresponding target SDK package from a central warehouse storing SDK packages configured for different tenants and used for database access, and connects data source information corresponding to the target tenant obtained from a data source configuration service center according to the target SDK package to the corresponding target database, so that the technical problem of configuration errors easy to occur when the data source is managed through the configuration file in the prior art is solved.
Other embodiments or specific implementations of the data source access device of the present invention may refer to the above method embodiments, and are not described herein.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. read-only memory/random-access memory, magnetic disk, optical disk), comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the invention, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.

Claims (10)

1. A data source access method, the data source access method comprising:
when receiving a database access request sent by a target tenant, searching a corresponding target SDK package from a central warehouse, wherein the central warehouse stores SDK packages configured for different tenants and used for database access;
sending a registration request to a data source configuration service center, and receiving a client identification number returned by the data source configuration service center when registration is successful;
acquiring data source information corresponding to a target tenant from the data source configuration service center through the target SDK packet based on the client identification number, the tenant code of the target tenant, the application service code, the key authentication type and the key;
and connecting to a corresponding target database according to the data source information.
2. The data source access method according to claim 1, wherein, when receiving the database access request sent by the target tenant, before the step of searching the central repository for the corresponding target SDK packet, the method further comprises:
acquiring target programs of different tenants accessing the database;
and packaging the target program into an SDK package through a preset management tool, and storing the SDK package into a central warehouse.
3. The data source access method according to claim 2, wherein, when receiving the database access request sent by the target tenant, before the step of searching the central repository for the corresponding target SDK packet, the method further comprises:
configuring a key authentication type and a key;
correspondingly, the step of sending a registration request to the data source configuration service center and receiving the client identification number returned by the data source configuration service center when the registration is successful comprises the following steps:
sending a registration request to a data source configuration service center so that the data source configuration service center can verify based on the key authentication type and the key when receiving the registration request;
and when the verification is successful, receiving the client identification number returned by the data source configuration service center.
4. The data source access method of claim 1, further comprising, after the step of connecting to the corresponding target database according to the data source information:
when a data source loading request is received, checking the data source loading request through the target SDK packet, and judging whether the data source needs to be loaded according to a checking result;
if yes, a target data source loading request is sent to the data source configuration service center through the target SDK packet, wherein the target data source loading request carries a target tenant code;
and receiving target data source information corresponding to the target tenant codes returned by the data source configuration service center based on the target data source loading request.
5. The data source access method of claim 4, wherein the target data source load request carries a target tenant code, the client identification number, and the key authentication type;
the data source configuration service center is used for checking whether the client identification number exists or not when the target data source loading request is received; if yes, carrying out key verification based on the key authentication type; and when the verification passes, returning the target data source information corresponding to the target tenant code.
6. The data source access method of claim 3, wherein the key authentication type comprises: AES symmetric encryption authentication, the key comprising: AES encryption key;
the data source configuration service center is used for decrypting request parameters in the registration request through the AES symmetric encryption authentication and the AES encryption key when the registration request is received; and when the decryption is successful, returning the client identification number.
7. The data source access method as claimed in claim 2, wherein after the step of packaging the program into SDK package by a preset management tool and storing the SDK package in the central repository, further comprising:
and acquiring annotation information of the loading-free data source API, and adding the annotation information to the SDK package.
8. A data source access device, the device comprising:
the system comprises an SDK packet searching module, a database access module and a database access module, wherein the SDK packet searching module is used for searching a corresponding target SDK packet from a central warehouse when receiving a database access request sent by a target tenant, and the central warehouse stores the SDK packets configured for different tenants and used for database access;
the registration request sending module is used for sending a registration request to the data source configuration service center and receiving a client identification number returned by the data source configuration service center when the registration is successful;
the data source acquisition module is used for acquiring data source information corresponding to a target tenant from the data source configuration service center through the target SDK packet based on the client identification number, the tenant code of the target tenant, the application service code, the key authentication type and the key;
and the database connection module is used for connecting to the corresponding target database according to the data source information.
9. A data source access device, the device comprising: a memory, a processor and a data source access program stored on the memory and executable on the processor, the data source access being configured to implement the steps of the data source access method of any one of claims 1 to 7.
10. A storage medium having stored thereon a data source access program which, when executed by a processor, implements the steps of the data source access method of any of claims 1 to 7.
CN202310064230.3A 2023-01-12 2023-01-12 Data source access method, device, equipment and storage medium Active CN116126914B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310064230.3A CN116126914B (en) 2023-01-12 2023-01-12 Data source access method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310064230.3A CN116126914B (en) 2023-01-12 2023-01-12 Data source access method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN116126914A true CN116126914A (en) 2023-05-16
CN116126914B CN116126914B (en) 2023-10-03

Family

ID=86296958

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310064230.3A Active CN116126914B (en) 2023-01-12 2023-01-12 Data source access method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116126914B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150074407A1 (en) * 2013-09-09 2015-03-12 Layer, Inc. Federated authentication of client computers in networked data communications services callable by applications
CN112307066A (en) * 2020-11-03 2021-02-02 平安普惠企业管理有限公司 Distributed data aggregation method, system, device and storage medium
CN112699399A (en) * 2021-03-22 2021-04-23 阿里云计算有限公司 Encryption database system, method and device for realizing encryption database system
WO2021128733A1 (en) * 2019-12-28 2021-07-01 南京理工大学 Hyperledger fabric blockchain private data storage and access system and method therefor
CN113922974A (en) * 2020-06-22 2022-01-11 中移(苏州)软件技术有限公司 Information processing method and system, front end, server and storage medium
CN114726606A (en) * 2022-03-31 2022-07-08 北京九州恒盛电力科技有限公司 User authentication method, client, gateway and authentication server

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150074407A1 (en) * 2013-09-09 2015-03-12 Layer, Inc. Federated authentication of client computers in networked data communications services callable by applications
WO2021128733A1 (en) * 2019-12-28 2021-07-01 南京理工大学 Hyperledger fabric blockchain private data storage and access system and method therefor
CN113922974A (en) * 2020-06-22 2022-01-11 中移(苏州)软件技术有限公司 Information processing method and system, front end, server and storage medium
CN112307066A (en) * 2020-11-03 2021-02-02 平安普惠企业管理有限公司 Distributed data aggregation method, system, device and storage medium
CN112699399A (en) * 2021-03-22 2021-04-23 阿里云计算有限公司 Encryption database system, method and device for realizing encryption database system
CN114726606A (en) * 2022-03-31 2022-07-08 北京九州恒盛电力科技有限公司 User authentication method, client, gateway and authentication server

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王世杰: "基于异构数据源的交通数据服务系统设计与实现", 《中国优秀硕士学位论文全文数据库信息科技辑》, vol. 2021, no. 04, pages 138 - 314 *

Also Published As

Publication number Publication date
CN116126914B (en) 2023-10-03

Similar Documents

Publication Publication Date Title
CN110365670B (en) Blacklist sharing method and device, computer equipment and storage medium
CN108200050B (en) Single sign-on server, method and computer readable storage medium
CN109639661B (en) Server certificate updating method, device, equipment and computer readable storage medium
US8898764B2 (en) Authenticating user through web extension using token based authentication scheme
US20170288872A1 (en) Activating mobile terminal token method
CN111314306A (en) Interface access method and device, electronic equipment and storage medium
CN110888838B (en) Request processing method, device, equipment and storage medium based on object storage
CN102171652A (en) Method for provisioning trusted software to an electronic device
CN110263579B (en) Data processing method, system and related equipment
CN111444500A (en) Authentication method, device, equipment and readable storage medium
CN112860778B (en) Database management method, device, equipment and medium for desktop application program
CN111625782B (en) Access authority control method and device for source code, computer equipment and storage medium
CN111740826B (en) Encryption method, decryption method, device and equipment based on encryption proxy gateway
CN111224952B (en) Network resource acquisition method and device for directional flow and storage medium
CN114281573A (en) Workflow data interaction method and device, electronic device and readable storage medium
CN111770072B (en) Method and device for accessing function page through single sign-on
CN112560003A (en) User authority management method and device
CN116126914B (en) Data source access method, device, equipment and storage medium
CN113221154A (en) Service password obtaining method and device, electronic equipment and storage medium
CN101325493B (en) Method and system for authenticating a user
KR101979320B1 (en) System and Method for automatic generation and execution of encryption SQL statements using meta-information and enterprise framework
CN112464259B (en) ERP page acquisition method, ERP page acquisition device, computer equipment and storage medium
CN105519069A (en) Data processing system, center apparatus and program
CN115248767A (en) Remote code testing method, device, equipment and storage medium
CN114338060A (en) Authority verification method, device, system, equipment and storage medium

Legal Events

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