Database access method, electronic device, and storage medium

By introducing a data processing module between the data monitoring and acquisition system and the storage module, and by decoupling the connection relationship between multiple data processing nodes, the security risks caused by the data monitoring system directly writing to the database are resolved, and the security of the database is improved.

CN122309543APending Publication Date: 2026-06-30SHENZHEN S F TAISEN HLDG (GRP) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENZHEN S F TAISEN HLDG (GRP) CO LTD
Filing Date
2024-12-27
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

In existing technologies, data monitoring and acquisition systems directly write data to the database, exposing the database to external applications and increasing the risk of database attacks.

Method used

By adding a data processing module between the data monitoring and acquisition system and the data storage module, and utilizing multiple data processing nodes, the connection between the data monitoring and acquisition module and the database is decoupled, thus avoiding direct access to the database.

Benefits of technology

This improves database security, prevents direct access to the database by the data monitoring and collection modules, and enhances the database's protection capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122309543A_ABST
    Figure CN122309543A_ABST
Patent Text Reader

Abstract

A database access method, electronic device, and storage medium are disclosed. The database access method is applied to a database access architecture, which includes a data monitoring and acquisition system, a data processing module, and a data storage module. The method includes: after multiple data processing nodes in the data processing module establish connections with multiple data monitoring and acquisition modules in the data monitoring and acquisition system, each data processing node performs the following operations on the connected data monitoring and acquisition modules: obtains the deployment status of the monitored device type at each monitoring location and the tag coverage status in the monitoring scenario; based on the obtained information, obtains the status of each tag in each monitoring device of the monitored device type; for each monitoring device, obtains the status of the monitoring device based on the status of all tags, and writes the status of the monitoring device and the status of each tag therein into the database. This avoids direct access to the database by the data monitoring and acquisition system, thus ensuring database security.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of database access, and more particularly to a database access method, electronic device, and storage medium. Background Technology

[0002] With the rapid development of fields such as industrial IoT, enterprise data management, network monitoring, financial data analysis, and smart cities, data monitoring and acquisition have become particularly important. As a result, data monitoring and acquisition systems are being used more and more widely. A data monitoring and acquisition system is a system used for real-time data acquisition and monitoring. After the data is acquired, it is usually necessary to save the acquired data to a database.

[0003] In related technologies, data monitoring and acquisition systems often use a direct write method to save the collected data to a database.

[0004] However, this approach exposes the database to external applications, increasing the risk of the database being attacked. Summary of the Invention

[0005] Based on the defects and shortcomings of the existing technology, this application proposes a database access method, device and storage medium that can avoid direct access to the database by the data monitoring and acquisition system, thereby ensuring the security of the database.

[0006] According to a first aspect of the embodiments of this application, a database access method is provided, applied to a database access architecture, the architecture including: a data monitoring and acquisition system, a data processing module, and a data storage module, the data monitoring and acquisition system including: multiple data monitoring and acquisition modules, the data processing module including: multiple data processing nodes, and the data storage module including: at least one database, the method including: after multiple data processing nodes establish connections with multiple data monitoring and acquisition modules, each data processing node performs the following operations on the connected data monitoring and acquisition module: obtaining the deployment status of the monitored device type in the monitoring scenario and the tag coverage status; wherein, the tags are used to identify the components of the monitored device type; obtaining the status of each tag in each location device of the monitored device type from the connected data monitoring and acquisition module according to the obtained deployment status and tag coverage status; for each location device, obtaining the status of the location device according to the status of all tags, and writing the obtained status of the location device and the status of each tag in the location device into the database.

[0007] According to a second aspect of the embodiments of this application, an electronic device is provided, including: a memory and a processor;

[0008] The memory is connected to the processor and is used to store programs; the processor is used to implement the database access method described above by running the programs in the memory.

[0009] According to a third aspect of the embodiments of this application, a storage medium is provided, on which a computer program is stored, and when the computer program is run by a processor, it implements the database access method as described above.

[0010] This application provides a database access method, electronic device, and storage medium. Each data processing node performs the following operations on the connected data monitoring and acquisition module: acquiring the deployment status and tag coverage of the monitored device types within the monitoring scenario; wherein, tags are used to identify components of the monitored device type; based on the acquired deployment status and tag coverage, obtaining the status of each tag in each location of the monitored device type from the connected data monitoring and acquisition module; for each location, acquiring the status of the location based on the status of all tags, and writing the acquired status of the location and the status of each tag in the location into the database. Because the connection between the data monitoring and acquisition module and the database is decoupled, direct access to the database by the data monitoring and acquisition module is avoided, thus improving database security. Attached Figure Description

[0011] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0012] Figure 1 A schematic flowchart illustrating a database access method provided in an embodiment of this application;

[0013] Figure 2 A schematic diagram illustrating a process for updating the status of target point devices in a database, provided as an embodiment of this application;

[0014] Figure 3 A flowchart illustrating another database access method provided in an embodiment of this application;

[0015] Figure 4 This is a schematic diagram of the structure of a database access device provided in an embodiment of this application;

[0016] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0017] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0018] In related technologies, data monitoring and acquisition systems often use a direct write method to save the collected data to the database. In this method, the data monitoring and acquisition system directly establishes a connection and accesses the database directly after the connection is established. Therefore, the database is exposed to external applications, which increases the risk of the database being attacked.

[0019] Therefore, this application provides a database access method. By adding a data processing module between the data monitoring and acquisition system and the data storage module, and utilizing multiple data processing nodes in the data processing module to complete the database writing, the connection between the data monitoring and acquisition module and the database is decoupled, avoiding direct access to the database by the data monitoring and acquisition module. (See also...) Figure 1 Its specific implementation is as follows:

[0020] After multiple data processing nodes establish connections with multiple data monitoring and acquisition modules, each data processing node performs the following operations on the connected data monitoring and acquisition modules: Step 100: Obtain the deployment status of the monitored device types and the tag coverage status in the monitoring scenario; wherein, the tags are used to identify the components of the monitored device types; Step 101: Based on the obtained deployment status and tag coverage status, obtain the status of each tag in each monitoring device of the monitored device type from the connected data monitoring and acquisition modules; Step 102: For each monitoring device, obtain the status of the monitoring device based on the status of all tags, and write the obtained status of the monitoring device and the status of each tag in the monitoring device into the database.

[0021] In practical applications, the data monitoring and acquisition system can be a Supervisory Control and Data Acquisition (SCADA) system, the data monitoring and acquisition module can be a module with an OPC-SERVER service deployed, and the data processing node can be an SDA (SCADA data receiving system) node. When the data monitoring and acquisition module is a module with an OPC-SERVER service deployed and the data processing node is an SDA node, the SDA uses the OPCUA reading method to read the status of each tag in each point device of the monitored device type from the SCADA's OPC-SERVER.

[0022] The monitored device type may be deployed at multiple locations in the monitoring scenario. Therefore, the deployment information of the monitored device type in the monitoring scenario refers to the deployment information of the monitored device type at all locations in the monitoring scenario. The monitored device type typically includes multiple components. Therefore, the label coverage information of the monitored device type in the monitoring scenario refers to the labels covered by each monitored device type. For example, a CP sorting machine includes 30 components, meaning the CP sorting machine covers 30 labels; an ICS sorting machine includes 17 components, meaning the ICS covers 17 labels; and a three-layer small item sorting machine includes 100 components, meaning the three-layer small item sorting machine covers 100 labels.

[0023] The deployment status of monitoring points and the label coverage in a monitoring scenario can be obtained through pre-established monitoring point deployment information tables and label coverage information tables. The point deployment information table records all deployment points for each device type in the monitoring scenario, i.e., the information of the point devices. The label coverage information table records the labels covered by each device type in the monitoring scenario, i.e., the information that forms the backup. Therefore, each data processing node can determine the information of all point devices of the monitored device type and the information of all labels in the connected data monitoring and acquisition module based on the point deployment information table and the label coverage information table. It can then obtain the status of each label in each point device of the monitored device type from the connected data monitoring and acquisition module.

[0024] The relationship between data processing nodes and data monitoring and acquisition modules can be one-to-one, where one data processing node connects to one data monitoring and acquisition module. In this relationship, each data processing node obtains the location deployment and tag coverage of the device types monitored by the connected data monitoring and acquisition module within the monitoring scenario. Alternatively, it can be a one-to-many relationship, where one data processing node connects to multiple data monitoring and acquisition modules. In this relationship, each data processing node obtains the location deployment and tag coverage of the device types monitored by the multiple connected data monitoring and acquisition modules within the monitoring scenario. Or, it can be a many-to-one relationship, where multiple data processing nodes connect to one data monitoring and acquisition module. In this relationship, each data processing node corresponding to the same data monitoring and acquisition module obtains the location deployment and tag coverage of some device types monitored by the connected data monitoring and acquisition module within the monitoring scenario.

[0025] The status of a tag can reflect the status of the component it represents. Taking a parts supply station as an example, assuming that the parts supply station includes three components, namely component 1, component 2 and component 3, the parts supply station contains three tags, namely tag A, tag B and tag C. Tag A is used to identify component 1, tag B is used to identify component 2, and tag C is used to identify component 3. Therefore, the status of tag A reflects the status of component 1, the status of tag B reflects the status of component 2, and the status of tag C reflects the status of component 3.

[0026] Furthermore, because each tag identifies a component of the equipment type at each location, the status of a location is determined by the status of all tags within that location. A location is considered normal only when all tags are in normal condition, and faulty only when any tag is in faulty condition. Taking the above example of a parts supply station comprising three components and three corresponding tags, the station is considered normal only when tags A, B, and C are all in normal condition, and faulty only when any tag is in faulty condition.

[0027] The database access method provided in this application involves each data processing node performing the following operations on the connected data monitoring and acquisition module: obtaining the deployment status and tag coverage of the monitored device types in the monitoring scenario; wherein, tags are used to identify the components of the monitored device type; based on the obtained deployment status and tag coverage, obtaining the status of each tag in each location of the monitored device type from the connected data monitoring and acquisition module; for each location, obtaining the status of the location based on the status of all tags, and writing the obtained status of the location and the status of each tag in the location into the database. Because the connection between the data monitoring and acquisition module and the database is decoupled, direct access to the database by the data monitoring and acquisition module is avoided, thus improving database security.

[0028] Since the data processing module is a new module added between the data monitoring and acquisition system and the data storage module, in order to enable the data processing nodes in the data processing module to obtain data from the data monitoring and acquisition module in the data monitoring and acquisition system, this application provides an optional embodiment that allows the data processing nodes to connect to the data monitoring and acquisition module, thereby ensuring the smooth progress of subsequent data acquisition. The specific implementation is as follows:

[0029] Multiple data processing nodes include a master data processing node and slave data processing nodes. The multiple data processing nodes and multiple data monitoring and acquisition modules are connected in the following way: the master data processing node assigns connection tasks to itself and each slave node; the master data processing node and each slave node connect to the corresponding data monitoring and acquisition module according to the obtained connection tasks.

[0030] The master processing node can be generated by electing a master. When the master node assigns connection tasks to itself and all slave nodes in a one-to-one correspondence, the master processing node and slave processing nodes connect to the data monitoring and acquisition module according to the connection tasks, forming a one-to-one connection relationship.

[0031] The data monitoring and acquisition module can be deployed in a dual-active configuration with one primary and one backup. By default, the primary service in the data monitoring and acquisition module is connected to the processing node. If the connection is unavailable or interrupted, it will automatically switch to the backup service.

[0032] To quickly determine the status of a location device based on the status of all tags, this application provides an optional embodiment that can quickly obtain the status of the location device, the specific implementation of which is described below:

[0033] The status of a tag is represented by a status identifier. The status of different tags is represented by status identifiers of the same or different data types. The step of obtaining the status of the location device based on the status of all tags includes: parsing the status identifiers of all tags according to the data parsing rules corresponding to the status identifiers of all tags to obtain the status of all tags; and performing an XOR operation on the status of all tags to obtain the status of the location device.

[0034] Typically, the state of a tag is represented by a state identifier of a certain data type, rather than in an intuitive way. Therefore, after obtaining the state identifier of each tag, it is necessary to parse the state representation according to the corresponding parsing rules in order to obtain the intuitive state.

[0035] Status identifiers used to represent tag status can include data types such as Boolean, byte array, bit array, and DWORD. Boolean status identifiers can include TRUE and FALSE. According to the parsing rules corresponding to Boolean data types, "TRUE" is parsed as 1, indicating a "fault" tag status, and "FALSE" is parsed as 0, indicating a "normal" tag status. DWORD status identifiers can include specific data, such as "9". According to the parsing rules corresponding to DWORD data types, 9 is converted to a 32-bit binary number, resulting in "0000000000000000000000000001001". According to the parsing rules corresponding to this data type, a specific bit is taken as the tag status. For example, taking the fourth bit from the least significant bit, the parsed status is "1", indicating a "fault" tag status.

[0036] In the specific implementation, to quickly obtain the status of the location device by XORing the status of all tags, the status of all tags can be represented as "0" or "1". This way, directly XORing the status of all tags yields the status representation of the location device, which is represented as "0" or "1". When the status of all tags in the location device is represented as "0", the status of the location device is represented as "0", indicating that the location device is in a "normal" state. When the status of any tag in the location device is represented as "1", the status of the location device is represented as "1", indicating that the location device is in a "fault" state. 。

[0037] In subsequent processes, to ensure that the changed state of any tag at each location device is written to the database, this application provides an optional embodiment that guarantees the changed state of the tag can be updated to the database. The specific implementation is as follows:

[0038] The method further includes: acquiring the change status of target tags whose status has changed in the connected data monitoring and acquisition module and the target location device to which they belong; and updating the status of the target location device in the database according to the acquired change status of the target tags and the target location device to which they belong.

[0039] The number of target tags whose status changes in the connected data monitoring and acquisition module may be one or more. When the number of target tags is multiple, obtaining the status change of the target tag whose status changes in the connected data monitoring and acquisition module and the target location device to which it belongs, and updating the status of the target location device in the database based on the obtained status change of the target tag and the target location device to which it belongs, means: obtaining the status change of each target tag whose status changes in the connected data monitoring and acquisition module and the target location device to which it belongs, and updating the status of the target location device in the database for each target tag based on the obtained status change of the target tag and the target location device to which it belongs.

[0040] The status of tags in the monitoring devices monitored by the data monitoring and acquisition module is not static. Initially, all tags in all devices may be in normal status, but as the devices operate, the status of some tags may change to fault. Therefore, it is necessary to update the status of the target devices in the database according to the changes in the status of the target tags and the target devices to which they belong.

[0041] To ensure that the status change of any tag in each location device is promptly written to the database, this application provides an optional embodiment that updates the database with the tag's status change in a timely manner, thereby ensuring the timely updating of data in the database. The specific implementation is as follows:

[0042] Subscribe to the tag status topics published by the connected data monitoring and acquisition module, and receive the change status of the target tag whose status has changed in real time when the tag status in the connected data monitoring and acquisition module changes.

[0043] The publish / subscribe pattern is a messaging pattern in which a message publisher sends a message to a topic, and a subscriber subscribes to the topic and receives the message when it is published to the topic.

[0044] To determine whether a change in the state of any tag at each location device will affect the state of the target location device, and to write the tag's change state and the device's change state into the database when the change affects the target location device, this application provides an optional embodiment that ensures the device states in the database are updated in a timely manner. This improves the accuracy of controlling the device states during subsequent device utilization. The specific implementation is as follows:

[0045] The status of the target point device in the database is updated based on the change status of the obtained target tag and the target point device to which it belongs, such as... Figure 2 As shown, the process includes: Step 200, obtaining the status of other tags besides the target tag in the target location device from the database; Step 201, determining whether the change in the status of the target tag will cause a change in the status of the target location device based on the obtained change in the status of the target tag and the status of other tags obtained from the database; Step 202, in response to the case that the change in the status of the target location device will cause a change in the status of the target location device, updating the status of the target location device in the database based on the change in the status of the target location device, and updating the status of the target tag in the database based on the change in the status of the target tag; Step 203, in response to the case that the change in the status of the target location device will not cause a change in the status of the target location device, updating the status of the target tag in the database based on the change in the status of the target tag.

[0046] Steps 202 and 203 are related by choice.

[0047] The target tag is only a part of the tags in the target location device. A change in the state of the target tag does not necessarily mean that the state of the target location device will change. Whether the state of the target location device has changed needs to be determined in conjunction with the state of the other tags in the target location device besides the target tag.

[0048] The following examples illustrate whether the status of a location device in the database needs to be updated. Assume the target location device contains four tags, and the target tag has only one instance. Example 1: Suppose the target tag's status changes from "Normal" to "Fault," so the changed status is "Fault." The target location device's status in the database is "Normal," and the other three tags for the target location device are also "Normal." Therefore, the target location device's status will change from "Normal" to "Fault." Thus, the target location device's status in the database should be updated based on its changed status, i.e., "Fault." Example 2: Suppose the target tag's status changes from "Fault" to "Normal." In the database, the target device's status is "faulty," while the other three tags for the target device are all "normal." Therefore, the target device's status will change from "faulty" to "normal." Thus, the database is updated with the target device's status updated to "normal." Example 3: Suppose the target tag's status changes from "faulty" to "normal," the target device's status in the database is "faulty," the other two tags for the target device are "normal," and the remaining tag is "faulty." Therefore, the target device's status remains unchanged, and the database is not updated with the target device's status.

[0049] Regardless of whether the change in the target tag's state causes a change in the state of the target location device, the state of the target tag in the database is updated according to the change in the target tag's state.

[0050] To avoid omissions in data writing, the changed states of all target tags and all target location devices whose states have changed are written to the database. This application provides an optional embodiment that ensures the orderly writing of the changed states of all target tags and all target location devices to the database, thereby guaranteeing the accuracy of the database tag and device states. The specific implementation is as follows:

[0051] Each point device and each tag within each point device corresponds to a write flag. When the write flag is a pending write identifier, it indicates that the status of the corresponding point device or tag needs to be written to the database. Updating the status of the target point device in the database based on its changing status includes: using a pre-activated write thread to poll all point devices for their corresponding write flags, and updating the status of the target point device in the database whenever a target point device with a pending write flag is polled. Updating the status of the target tag in the database based on its changing status includes: using a pre-activated write thread to poll all tags for their corresponding write flags, and updating the status of the target tag in the target point device in the database whenever a target tag with a pending write flag is polled.

[0052] Each point device corresponds to a write flag bit. When the status of a point device changes (the point device whose status changes is called the target point device), the write flag bit of the target point device is indicated as a pending write identifier.

[0053] The writing thread can trigger polling at a preset frequency or at a non-fixed frequency based on actual needs. A single writing thread can be used to poll all location devices, and then the same thread can be used to poll all tags; alternatively, two writing threads can be used, one to poll all location devices and the other to poll all tags, with both threads operating simultaneously; or multiple writing threads can be used, one to poll all location devices and the remaining threads each handling multiple tags for one location device, multiple locations for one tag, or multiple locations for multiple tags, with multiple writing threads operating concurrently.

[0054] For the write flag of the point device, the write thread sequentially polls the write flag of all point devices, and determines whether each polled write flag is a write-to-be-written identifier. When the write flag of a target point device is polled as a write-to-be-written identifier, the status of the target point device in the database is updated using the changed status of the target point device. When the write flag of another point device is polled as a write-to-be-written identifier, no processing is performed and the polling continues until the write flags of all point devices have been polled.

[0055] For the write flag of tags in the point device, for each point device, the write thread sequentially polls the write flag of all tags in that point device, and determines whether each polled write flag is a write flag. When a target tag with a write flag is a write flag is found, the status of the target tag in the database is updated using the change status of the target tag. When other tags with write flags that are not write flags are found, no processing is done and polling continues until all the write flags of all tags in that point device have been polled, and then the polling begins for the write flags of the next point device, until all the write flags of all tags in all point devices have been polled.

[0056] To alleviate the storage pressure on the database, this application provides an optional embodiment that can reduce the storage pressure on the database, the specific implementation of which is as follows:

[0057] The at least one database includes: multiple databases, which are used to store the status of point devices of completely different device types and the status of all tags contained therein, or to store the status of point devices of at least partially the same device type and the status of all tags contained therein.

[0058] When multiple databases are used to store the status of point devices of completely different device types and the status of all the tags they contain, each database is used to store the status of point devices of a certain device type and the status of all the tags they contain. The device types stored in different databases are different. When each node writes data to the database, it first determines the database used to store the status of point devices of the device type monitored by the connected data monitoring and acquisition module and the status of all the tags it contains, and then writes the status of point devices of the monitored device type and the status of all the tags it contains into the determined database.

[0059] When multiple databases are used to store the status of point devices of at least some of the same device type and the status of all the tags they contain, and at least two databases store the status of point devices of the same device type and the status of all the tags they contain, each node, when writing data to the database, first determines the database used to store the status of point devices of the device type monitored by the connected data monitoring and acquisition module and the status of all the tags they contain. The determined database may be one or more, and then writes the status of point devices of the monitored device type and the status of all the tags they contain into the determined database.

[0060] Multiple databases can be of the same or different types. Specifically, there can be two databases: one is an Oracle database and the other is a MySQL database. When each node writes the device status and tag status of the corresponding device type, it uses the Oracle database to store the status of the point devices of the device type related to path calculation and the status of all the tags contained therein, and uses the MySQL database to store the status of the point devices of all device types and the status of all the tags contained therein.

[0061] This application also provides a database access method, such as... Figure 3 As shown, it includes:

[0062] Step 300: The program starts and uses the master election method to obtain the master SDA node. The master SDA node assigns OPC-SERVER connection tasks to each SDA node.

[0063] Step 301: Each SDA node loads the mapping table between tag names and point devices according to the OPC-SERVER connection task and writes it into memory.

[0064] The mapping table between tag names and point devices can be denoted as T_SCD_POINT_MAPPING.

[0065] Step 302: Each SDA node loads the tag status value from the device's real-time status table according to the loaded point identifier and writes it into memory.

[0066] The device real-time status table can be represented as T_SCD_DEVICE_STATUS, and the tag status value in the device real-time status table is empty in the initial state.

[0067] Step 303: Each node connects to the OPC-SERVER according to the OPC-SERVER connection task.

[0068] Step 304: The acquisition thread reads the tag status value of each point device with that tag from the corresponding OPC-SERVER based on the loaded tag name, and writes it to the queue.

[0069] Step 305: The parsing thread retrieves the tag status values ​​from the queue, parses different tag data types, obtains the tag status value of each point device in the monitored device type under each tag, and then performs XOR processing on the status values ​​of all tags of the point device according to the correspondence table between tag name and point device, and updates the write database flag bit according to the processing result.

[0070] Step 306: The write thread polls the write flag in memory and writes the write flag, representing the tag status value of the identifier to be written, into the database.

[0071] In practical applications, log tables such as T_SCD_DVC_LOG in the database can be written to, and tag status values ​​in status tables such as T_SCD_DEVICE_STATUS in the database can be updated.

[0072] Step 307: During operation, obtain the status changes of the tags in real time by subscribing.

[0073] The subscription mode can be either OPC-Client subscription mode or OPC-SERVER periodically pushing down the tag value whose status has changed.

[0074] Step 308: Based on the correspondence table between tag names and location devices, determine whether the status of the location devices needs to be updated, and update the database if necessary.

[0075] The database access method provided in this application improves database security by decoupling the connection between the data monitoring and acquisition module and the database, thus avoiding direct access to the database by the data monitoring and acquisition module.

[0076] This application also provides a database access device, such as... Figure 4 As shown, it includes:

[0077] The first acquisition module 400 is used to acquire the deployment status of the monitored device types and the tag coverage status of the monitored devices in the monitoring scenario by the data monitoring and acquisition modules connected to each data processing node; wherein, the tags are used to identify the components of the monitored device types; the second acquisition module 401 is used to acquire the status of each tag in each monitoring device of the monitored device type from the data monitoring and acquisition modules connected to each data processing node according to the acquired deployment status and tag coverage status; the data writing module 402 is used to acquire the status of each monitoring device according to the status of all tags for each monitoring device, and write the acquired status of the monitoring device and the status of each tag in the monitoring device into the database.

[0078] The database access device provided in this application acquires the deployment status and tag coverage of the device types monitored by the data monitoring and acquisition module connected to each data processing node in the monitoring scenario; based on the acquired deployment status and tag coverage, it retrieves the status of each tag in each location of the monitored device type from the data monitoring and acquisition module connected to each data processing node; for each location, it retrieves the status of the location based on the status of all tags, and writes the obtained status of the location and the status of each tag in the location into the database. Because the connection between the data monitoring and acquisition module and the database is decoupled, direct access to the database by the data monitoring and acquisition module is avoided, thus improving database security.

[0079] This application also provides an electronic device, such as... Figure 5 As shown, it includes: memory 500 and processor 510;

[0080] The memory 500 is connected to the processor 510 and is used to store programs;

[0081] The processor 510 is used to implement the database access method described in the above embodiments by running the program in the memory 500.

[0082] Specifically, the aforementioned electronic device may also include: a bus, a communication interface 520, an input device 530, and an output device 540.

[0083] The processor 510, memory 500, communication interface 520, input device 530, and output device 540 are interconnected via a bus. Among them:

[0084] A bus can include a pathway for transmitting information between various components of a computer system.

[0085] The processor 510 can be a general-purpose processor, such as a general-purpose central processing unit (CPU), a microprocessor, etc., or an application-specific integrated circuit (ASIC), or one or more integrated circuits used to control the execution of the program of the present invention. It can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0086] The processor 510 may include a main processor, as well as a baseband chip, modem, etc.

[0087] The memory 500 stores a program that executes the technical solution of this invention, and may also store an operating system and other key business functions. Specifically, the program may include program code, which includes computer operation instructions. More specifically, the memory 500 may include read-only memory (ROM), other types of static storage devices capable of storing static information and instructions, random access memory (RAM), other types of dynamic storage devices capable of storing information and instructions, disk storage, flash memory, etc.

[0088] Input device 530 may include a device for receiving data and information input by a user, such as a keyboard, mouse, camera, scanner, light pen, voice input device, touch screen, pedometer, or gravity sensor.

[0089] Output device 540 may include devices that allow information to be output to a user, such as a display screen, printer, speaker, etc.

[0090] The communication interface 520 may include a device that uses any transceiver to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Network (WLAN), etc.

[0091] The processor 510 executes the program stored in the memory 500 and calls other devices, which can be used to implement the various steps of any of the database access methods provided in the above embodiments of this application.

[0092] In addition to the methods and devices described above, embodiments of this application may also be computer program products, which include computer program instructions that, when executed by a processor, cause the processor to perform the steps in the database access methods according to various embodiments of this application as described in any of the above embodiments of this specification.

[0093] The computer program product can be written in any combination of one or more programming languages ​​to perform the operations of the embodiments of this application. The programming languages ​​include object-oriented programming languages ​​such as Java and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0094] Furthermore, this application also provides a storage medium storing a computer program, which, when executed by a processor, implements the database access method described in any of the above embodiments.

[0095] For the foregoing method embodiments, in order to simplify the description, they are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, because according to this application, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0096] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For apparatus embodiments, since they are basically similar to method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.

[0097] The steps in the methods of the various embodiments of this application can be adjusted, merged, or deleted in order according to actual needs, and the technical features described in each embodiment can be replaced or combined.

[0098] The modules and sub-modules in the various embodiments of the present application's devices and terminals can be merged, divided, and deleted according to actual needs.

[0099] It should be understood that the disclosed terminals, devices, and methods can be implemented in other ways, given the several embodiments provided in this application. For example, the terminal embodiments described above are merely illustrative. For instance, the division of modules or sub-modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple sub-modules or modules may be combined or integrated into another module, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or modules, and may be electrical, mechanical, or other forms.

[0100] The modules or submodules described as separate components may or may not be physically separate. The components that constitute a module or submodule may or may not be physical modules or submodules; that is, they may be located in one place or distributed across multiple network modules or submodules. Some or all of the modules or submodules can be selected to achieve the purpose of this embodiment's solution, depending on actual needs.

[0101] Furthermore, the functional modules or sub-modules in the various embodiments of this application can be integrated into one processing module, or each module or sub-module can exist physically separately, or two or more modules or sub-modules can be integrated into one module. The integrated modules or sub-modules described above can be implemented in hardware or in the form of software functional modules or sub-modules.

[0102] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0103] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software unit executed by a processor, or a combination of both. The software unit can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0104] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0105] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A database access method, characterized in that, The method is applied to a database access architecture, which includes: a data monitoring and acquisition system, a data processing module, and a data storage module. The data monitoring and acquisition system includes multiple data monitoring and acquisition modules, the data processing module includes multiple data processing nodes, and the data storage module includes at least one database. After multiple data processing nodes establish connections with multiple data monitoring and acquisition modules, each data processing node performs the following operations on the connected data monitoring and acquisition modules: The data monitoring and acquisition module obtains information on the deployment of the monitored devices in the monitoring scenario, as well as the label coverage; the labels are used to identify the components of the monitored device types. Based on the obtained point deployment information and tag coverage, the status of each tag in each point device of the monitored device type is obtained from the connected data monitoring and acquisition module; For each point device, the status of the point device is obtained based on the status of all tags, and the obtained status of the point device and the status of each tag in the point device are written into the database.

2. The method according to claim 1, characterized in that, Multiple data processing nodes include: a master data processing node and slave data processing nodes. These multiple data processing nodes are connected to multiple data monitoring and acquisition modules through the following methods: The master data processing node assigns connection tasks to itself and each slave node; The master data processing node and each slave node connect to the corresponding data monitoring and acquisition module according to the obtained connection task.

3. The method according to claim 1, characterized in that, The status of a tag is represented by a status identifier. Different tags can be represented by status identifiers of the same or different data types. Obtaining the status of the location device based on the status of all tags includes: The status of each label is obtained by parsing the status identifiers of all labels according to the data parsing rules corresponding to the status identifiers of all labels. The status of the point device is obtained by performing an XOR operation on the status of all tags.

4. The method according to claim 1, characterized in that, Also includes: Acquire the status changes of target tags whose status has changed in the connected data monitoring and acquisition module, as well as the target location devices to which they belong; The status of the target location device in the database is updated based on the changes in the obtained target label and the target location device to which it belongs.

5. The method according to claim 4, characterized in that, The changes in the status of target tags whose status has changed in the data monitoring and acquisition module that acquires the connection include: Subscribe to the tag status topics published by the connected data monitoring and acquisition module, and receive the change status of the target tag whose status has changed in real time when the tag status in the connected data monitoring and acquisition module changes.

6. The method according to claim 4, characterized in that, The step of updating the status of the target point device in the database based on the obtained change status of the target tag and the target point device to which it belongs includes: Retrieve the status of other tags in the target location device besides the target tag from the database; Based on the changes in the target tag obtained and the states of other tags obtained from the database, it is determined whether the change in the state of the target tag will cause a change in the state of the target location device. In response to situations that would cause a change in the status of the target location device, the status of the target location device in the database is updated according to the changed status of the target location device, and the status of the target tag in the database is updated according to the changed status of the target tag; In response to situations where the status of the target location device does not change, the status of the target tag in the database is updated based on the change in the status of the target tag.

7. The method according to claim 6, characterized in that, Each point device and each tag in each point device corresponds to a write database flag. When the write database flag is a pending write identifier, it means that the status of the corresponding point device or tag needs to be written to the database. The step of updating the status of the target point device in the database based on the changed status of the target point device includes: The write database thread is pre-activated to poll the write database flags corresponding to all point devices. Whenever a target point device with a write database flag set to be written is polled, the status of the target point device in the database is updated using the changed status of the target point device. The step of updating the state of the target tag in the database according to the change state of the target tag includes: The system uses a pre-activated write database thread to poll the write database flags corresponding to all tags. Whenever the polled write database flag is a target tag with a write identifier, the system updates the status of the target tag in the target location device in the database using the change status of the target tag.

8. The method according to claim 1, characterized in that, The at least one database includes: multiple databases, which are used to store the status of point devices of completely different device types and the status of all tags contained therein, or to store the status of point devices of at least partially the same device type and the status of all tags contained therein.

9. An electronic device, characterized in that, include: Memory and processor; The memory is connected to the processor and is used to store programs; The processor is configured to implement the database access method as described in any one of claims 1-8 by running a program in the memory.

10. A storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the database access method as described in any one of claims 1-8.