CN110544092B - Dynamic newly-added multi-type database data operation chaining method for block chain - Google Patents

Dynamic newly-added multi-type database data operation chaining method for block chain Download PDF

Info

Publication number
CN110544092B
CN110544092B CN201910777111.6A CN201910777111A CN110544092B CN 110544092 B CN110544092 B CN 110544092B CN 201910777111 A CN201910777111 A CN 201910777111A CN 110544092 B CN110544092 B CN 110544092B
Authority
CN
China
Prior art keywords
database
data source
information
block chain
data
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.)
Active
Application number
CN201910777111.6A
Other languages
Chinese (zh)
Other versions
CN110544092A (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.)
Hangzhou Qulian Technology Co Ltd
Original Assignee
Hangzhou Qulian Technology 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 Hangzhou Qulian Technology Co Ltd filed Critical Hangzhou Qulian Technology Co Ltd
Priority to CN201910777111.6A priority Critical patent/CN110544092B/en
Publication of CN110544092A publication Critical patent/CN110544092A/en
Application granted granted Critical
Publication of CN110544092B publication Critical patent/CN110544092B/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/21Design, administration or maintenance of databases
    • G06F16/219Managing data history or versioning
    • 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/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/389Keeping log of transactions for guaranteeing non-repudiation of a transaction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Abstract

The invention discloses a dynamic newly-increased multi-type database data operation chaining method of a block chain, which specifically comprises the following steps: (1) after the block chain application server is started, the system loads data source information corresponding to the configured data source by default, and meanwhile, a placeholder template file is initialized; (2) dynamically adding data source information; (3) a universal factory constructs a multi-type SqlSession; (4) and adding the data of the multi-type database to operate uplink. The invention solves the problems that under the condition that the quantity of various databases on the block chain application service is uncertain, the databases can be flexibly and dynamically added in the same block chain web application service, the database switching data acquisition can be carried out according to the service conditions, and meanwhile, the data chaining is realized.

Description

Dynamic newly-added multi-type database data operation chaining method for block chain
Technical Field
The invention relates to a block chain technology, an intelligent contract, a Spring framework and a Mybatis framework technology, in particular to a dynamic newly-added multi-type database data operation uplink method for a block chain.
Background
The block chain technology is a novel decentralized protocol, digital currency transactions or other data can be safely stored, information cannot be forged and tampered, transaction confirmation on the block chain is completed by all nodes on the block chain together, consistency of the transaction confirmation is guaranteed by a consensus algorithm, a public account book is maintained on the block chain and used for storing balance of all users on a block chain network, and any node of the public account book on a storage block is visible, so that counterfeiting and tampering of the public account book are guaranteed.
The intelligent contract on the blockchain refers to a string of binary codes written and compiled by the security and run on the blockchain, and data storage, reading and writing and some logic operations on the blockchain can be realized through the intelligent contract, so that some applications based on the blockchain are completed by using the intelligent contract.
The Spring framework is a lightweight Java development framework and is created to solve the complexity of enterprise application development. The core of Spring is control inversion (IoC) and facet oriented (AOP). Briefly, Spring is a layered JavaSE/EE full-stack (one-stop) lightweight open source framework.
The MyBatis framework, an excellent persistent layer framework, supports customized SQL, stored procedures, and advanced mapping. MyBatis avoids almost all JDBC code and manual setting of parameters and acquisition of result sets. MyBatis can use simple XML or annotations to configure and map native information, mapping interfaces and Java's POJOs (Plain Ordinary Java Object) into records in the database.
Disclosure of Invention
Since the general blockchain system relates to databases and the quantity is fixed, initialization is completed in the system starting process, and frequent addition or reduction of databases occurs under the condition of rapid development of services, the most direct problem is that items need to be restarted to cause the fluency of the services to be affected to a certain extent, and meanwhile, data chaining is performed by executing sql language to acquire data. The invention aims to provide a dynamic newly-added multi-type database data operation uplink method of a block chain aiming at the expansion of the prior block chain technology.
The purpose of the invention is realized by the following technical scheme: under the condition of not changing the normal operation of the service, different types of databases can be dynamically added, the databases can be directly operated on the interface, and meanwhile, the data can be acquired and the data uplink can be operated according to different scenes by combining the service codes.
The invention is realized by the following technical scheme: a method for dynamically adding a multi-type database data operation uplink of a block chain comprises the following steps:
(1) after the block chain application server is started, the system loads data source information corresponding to the configured data source in a default mode, meanwhile, a placeholder template file is initialized, and the data source comprises a metadata base and a newly added data source.
(2) Dynamically adding data source information:
(2.1) dynamically adding drive information: and uploading the database driver to the block chain application server, and filling the version number of the database driver, wherein the drive information uploaded to the block chain application server by the database driver is encrypted and stored in the metadata base, and the drive information comprises the address uploaded by the database driver and the corresponding drive version number.
(2.2) dynamically adding database connection information: and 2.1, adding the connection information of the database for the database driver uploaded in the step 2.1, associating the connection information of the newly added database with the drive information, and encrypting and storing the information to the metadata base. The connection information of the newly added database comprises an ip, a port number, a password and a data source name of the database server.
(2.3) dynamically selecting database script file information: the block chain application server scans all database script file names in the system and displays the database script file names on an operation interface, an operator creates a database script group, the database script file names are associated with the database script group, the script group is associated with the data source information, and the associated information is encrypted and stored in the metadata base.
(3) The general factory constructs a multi-type SqlSession:
after a user selects a certain data source name, the system firstly dynamically fills the data source information into the placeholder template file, a dom and sax resolver is adopted to perform mixed resolution on the placeholder template file, the system reads the database connection information, and finally, a factory method mode is used for combining and constructing a corresponding SqlSession and storing the SqlSession in a custom session pool, so that the system is convenient to obtain and use when operating the data source.
(4) And (3) adding data operation chaining of the multi-type database:
a. code level: adding annotations on a computer function method by utilizing an AOP section technology, wherein the annotations specify data source names, and the computer function method operates data in data source information corresponding to the data source names according to the data source names specified by the annotations in the execution process and records the operation on a chain.
b. An operation interface: dynamically adding new data source information by the user through the step 2 under the condition that the application is not restarted, displaying the added new data source name in a drop-down list selectable by the user, manually switching the data source name by the user, compiling and executing an sql script, operating and selecting a data source corresponding to the data source name, and linking the operation record; or automatically executing the sql script in the compiled database script file according to the service, and linking the operation records.
Further, the placeholder template file in step 1 comprises: database driving information, database connection information and database script file information.
The invention has the beneficial effects that: adding dynamic data sources of block chain application: under the conditions that the database is transversely copied (non-horizontally split), the type of the database is not fixed, and the quantity of the database is not fixed, the data acquisition and uplink of a plurality of types of databases are effectively realized without restarting an application to dynamically add a data source, so that the data operation of service separation and uplink can be realized, the data operation and uplink purpose can also be realized according to the service requirement by combining with the service, and the data are stored in a metadata database in a symmetrical encryption mode in order to ensure the resource information safety of the data source; the data source switching mode of the block chain application is diversified: on one hand, a tangent plane technology can be applied to construct a tangent plane, a data source of computer function operation is appointed through annotation configuration, and on the other hand, data source switching can be carried out on an operation interface through selecting a data source name to operate the selected data source; multi-type data source adaptation for blockchain applications: based on a factory design mode, identifying the driver by constructing an identification data source driver framework, constructing SqlSession factories of different types of data sources, and acquiring the sqlSession created by the SqlSession factories from a session pool to operate uplink on the data sources when the action of operating the data sources is executed.
Drawings
FIG. 1 is a flow chart of the method application of the present invention;
FIG. 2 is a flow chart of an implementation of an embodiment of the present invention.
Detailed Description
The present invention will be described in detail below with reference to the accompanying drawings and examples, and the objects and effects of the present invention will become more apparent.
Fig. 1 is a flowchart of a method for dynamically adding a new multi-type database data operation uplink in a block chain according to the present invention, and the method specifically includes the following steps:
(1) after the block chain application server is started or restarted, the system loads data source information corresponding to the configured data sources by default and initializes the placeholder template file at the same time, wherein the data sources comprise a metadata base and newly-added data sources, only the metadata base is loaded for the first time, and the initialization number is increased along with the increase of the data sources. The placeholder template file comprises: database driving information, database connection information and database script file information.
(2) Dynamically adding data source information:
(2.1) dynamically adding drive information: and uploading the database driver to the block chain application server, and filling the version number of the database driver, wherein the drive information uploaded to the block chain application server by the database driver is encrypted and stored in the metadata base, and the drive information comprises the address uploaded by the database driver and the corresponding drive version number.
(2.2) dynamically adding database connection information: and 2.1, adding the connection information of the database for the database driver uploaded in the step 2.1, associating the connection information of the newly added database with the drive information, and encrypting and storing the information to the metadata base. The connection information of the newly added database comprises an ip, a port number, a password and a data source name of the database server.
(2.3) dynamically selecting database script file information: the block chain application server scans all database script file names in the system and displays the database script file names on an operation interface, an operator creates a database script group, the database script file names are associated with the database script group, the script group is associated with the data source information, and the associated information is encrypted and stored in the metadata base.
(3) The general factory constructs a multi-type SqlSession:
after a user selects a certain data source name, the system firstly dynamically fills the data source information into the placeholder template file, a dom and sax resolver is adopted to carry out mixed resolution on the placeholder template file, the system reads the database connection information, and finally, a factory method mode is used for combination and construction of a corresponding SqlSession which is stored in a custom session pool, so that the system is convenient to use. The method has the advantages that the multi-type SqlSession established by a factory has the function of adapting to the newly-added multi-type data sources in the block chain application, and different kinds of data sources are operated by using different sqlsessens.
(4) And (3) adding data operation chaining of the multi-type database:
the data source switching mode applied to the newly added block chain is diversified, and the method can be realized in the following mode:
a. code level: adding annotations on a computer function method by utilizing an AOP section technology, wherein the annotations specify data source names, and the computer function method operates data in data source information corresponding to the data source names according to the data source names specified by the annotations in the execution process and records the operation on a chain.
b. An operation interface: dynamically adding new data source information by the user through the step 2 under the condition that the application is not restarted, displaying the added new data source name in a drop-down list selectable by the user, manually switching the data source name by the user, compiling and executing an sql script, operating and selecting a data source corresponding to the data source name, and linking the operation record; or automatically executing the sql script in the compiled database script file according to the service, and linking the operation records.
Examples
Fig. 2 is a flowchart of chain operation for the newly added mysql data according to the present invention, which includes the following steps:
a management platform based on block chain, there are numerous applications of horizontal replication that need to collect data uplink below, many applications are different in corresponding library type, at this moment because the business needs to deploy new replication application in one/multiple regions, if these databases are mysql edition, the operation steps are as follows:
(1) starting a block chain application server, loading a configured data source by default by a system, and initializing a placeholder template file at the same time;
(2.1) entering a drive management module, namely uploading mysql database drive, filling a corresponding version number of 5.7, and storing the address and the version number of the uploaded drive in the server to a metadata base;
(2.2) entering a database connection module: and selecting the uploaded drive in the last step, filling in a server ip, a port number, a password and a data source name of the newly added mysql database, associating the connection information of the newly added database and the drive information, and encrypting and storing the connection information of the newly added database and the drive information to the metadata database.
And (2.3) entering a database script management module, namely scanning all database script file names in the system by the block chain application server and displaying the database script file names on an operation interface, creating database script groups, selecting the scanned database script file names to be associated with the database script groups, associating the database script groups with the mysql data source names newly added in the last step, and encrypting and storing the database script groups in a metadata base.
(3) After the new mysql data source is added, the system uses the sqlsessesion factory to create the sqlsesion for the newly added mysql data source and stores the sqlsesion into the session pool.
(4) During the use process, a developer can add a comment such as @ DB (mysql) in which a data source name is specified on a computer function through a tangent plane technology, and the computer function can operate and uplink data in the specified data source (mysql); non-developers can select the name of the mysql data source newly added on the operation interface, and then compile database scripts on the operation interface to chain up the data, or chain up the operation data according to the service execution of the system and the sql in the compiled database script file.

Claims (2)

1. A method for dynamically adding a new multi-type database data operation uplink of a block chain is characterized by comprising the following steps:
(1) after a block chain application server is started, a system loads data source information corresponding to a configured data source by default, and meanwhile, a placeholder template file is initialized, wherein the data source comprises a metadata base and a newly added data source;
(2) dynamically adding data source information:
(2.1) dynamically adding drive information: uploading a database driver to the block chain application server, and filling in the version number of the database driver, wherein the drive information uploaded to the block chain application server by the database driver is encrypted and stored in the metadata base, and the drive information comprises an address uploaded by the database driver and a corresponding drive version number;
(2.2) dynamically adding database connection information: for the database driver uploaded in the step 2.1, adding database connection information, associating the added database connection information with the driver information, encrypting and storing the information to the metadata base, wherein the added database connection information comprises ip, port number, password and data source name of a database server;
(2.3) dynamically selecting database script file information: the block chain application server scans all database script file names in the system and displays the database script file names on an operation interface, an operator creates a database script group, the database script file names are associated with the database script group, the script group is associated with the data source information, and the associated information is encrypted and stored in the metadata base;
(3) the general factory constructs a multi-type SqlSession:
after a user selects a certain data source name, the system firstly dynamically fills the data source information into the placeholder template file, a dom and sax resolver is adopted to carry out mixed resolution on the placeholder template file, the system reads the database connection information, and finally, a factory method mode is used for combining and constructing a corresponding SqlSession and storing the SqlSession in a custom session pool, so that the system is convenient to obtain and use when operating the data source;
(4) and (3) adding data operation chaining of the multi-type database:
(a) code level: adding annotations on a computer function method by utilizing an AOP section technology, wherein the annotations specify data source names, and the computer function method operates data in data source information corresponding to the data source names according to the data source names specified by the annotations in the execution process and links the operation records; (b) an operation interface: dynamically adding new data source information by the user through the step 2 under the condition that the application is not restarted, displaying the added new data source name in a drop-down list selectable by the user, manually switching the data source name by the user, compiling and executing an sql script, operating and selecting a data source corresponding to the data source name, and linking the operation record; or automatically executing the sql script in the compiled database script file according to the service, and linking the operation records.
2. The method for linking data operations of a dynamically added multi-type database according to claim 1, wherein the placeholder template file in step 1 comprises: database driving information, database connection information and database script file information.
CN201910777111.6A 2019-08-22 2019-08-22 Dynamic newly-added multi-type database data operation chaining method for block chain Active CN110544092B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910777111.6A CN110544092B (en) 2019-08-22 2019-08-22 Dynamic newly-added multi-type database data operation chaining method for block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910777111.6A CN110544092B (en) 2019-08-22 2019-08-22 Dynamic newly-added multi-type database data operation chaining method for block chain

Publications (2)

Publication Number Publication Date
CN110544092A CN110544092A (en) 2019-12-06
CN110544092B true CN110544092B (en) 2022-04-01

Family

ID=68711872

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910777111.6A Active CN110544092B (en) 2019-08-22 2019-08-22 Dynamic newly-added multi-type database data operation chaining method for block chain

Country Status (1)

Country Link
CN (1) CN110544092B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111324591B (en) * 2020-01-20 2021-02-12 腾讯科技(深圳)有限公司 Block chain bifurcation detection method and related device
CN113254455B (en) * 2021-06-24 2023-10-27 中国平安人寿保险股份有限公司 Dynamic configuration method and device of database, computer equipment and storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6728713B1 (en) * 1999-03-30 2004-04-27 Tivo, Inc. Distributed database management system
CN102081661A (en) * 2011-01-19 2011-06-01 吉林大学 Data integration method and system of heterogeneous relational database based on XML (Extensive Makeup Language)
CN106844643A (en) * 2017-01-13 2017-06-13 王洋 A kind of Database Dynamic generation method based on template engine
CN108647361A (en) * 2018-05-21 2018-10-12 中国工商银行股份有限公司 A kind of date storage method, apparatus and system based on block chain
CN108694669A (en) * 2018-07-18 2018-10-23 矩阵元技术(深圳)有限公司 A kind of block chain intelligence contract implementation method and device
CN109189841A (en) * 2018-07-24 2019-01-11 中国电力科学研究院有限公司 A kind of multi-data source access method and system
CN109241035A (en) * 2018-08-28 2019-01-18 福建南威软件有限公司 A kind of custom script realizes the automatic deployment method of database
CN109547488A (en) * 2018-12-29 2019-03-29 杭州趣链科技有限公司 A kind of trust data calculating and exchange system based on alliance's block chain
CN109710680A (en) * 2018-12-29 2019-05-03 杭州趣链科技有限公司 A kind of block chain data processing engine and operating method
CN109978573A (en) * 2019-04-03 2019-07-05 上海中商网络股份有限公司 A kind of information source tracing system based on block chain

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6728713B1 (en) * 1999-03-30 2004-04-27 Tivo, Inc. Distributed database management system
CN102081661A (en) * 2011-01-19 2011-06-01 吉林大学 Data integration method and system of heterogeneous relational database based on XML (Extensive Makeup Language)
CN106844643A (en) * 2017-01-13 2017-06-13 王洋 A kind of Database Dynamic generation method based on template engine
CN108647361A (en) * 2018-05-21 2018-10-12 中国工商银行股份有限公司 A kind of date storage method, apparatus and system based on block chain
CN108694669A (en) * 2018-07-18 2018-10-23 矩阵元技术(深圳)有限公司 A kind of block chain intelligence contract implementation method and device
CN109189841A (en) * 2018-07-24 2019-01-11 中国电力科学研究院有限公司 A kind of multi-data source access method and system
CN109241035A (en) * 2018-08-28 2019-01-18 福建南威软件有限公司 A kind of custom script realizes the automatic deployment method of database
CN109547488A (en) * 2018-12-29 2019-03-29 杭州趣链科技有限公司 A kind of trust data calculating and exchange system based on alliance's block chain
CN109710680A (en) * 2018-12-29 2019-05-03 杭州趣链科技有限公司 A kind of block chain data processing engine and operating method
CN109978573A (en) * 2019-04-03 2019-07-05 上海中商网络股份有限公司 A kind of information source tracing system based on block chain

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于区块链的地学大数据管理;王亮等;《国防科技》;20180420;第39卷(第02期);全文 *
面向产业链协同SaaS平台的多源异构信息动态集成技术研究;吕瑞等;《计算机科学》;20160215;第43卷(第02期);全文 *

Also Published As

Publication number Publication date
CN110544092A (en) 2019-12-06

Similar Documents

Publication Publication Date Title
US10565095B2 (en) Hybrid testing automation engine
US10324690B2 (en) Automated enterprise software development
CN110147369B (en) Data splitting and write redirection in a multi-leased database system
CN109947767B (en) System sharing type in multi-leasing database system
US8910117B2 (en) Customizing and performing policy in version control
US7684964B2 (en) Model and system state synchronization
CN101218565B (en) Technique for migrating a host environment to a new system platform, transaction control assembly and related disperse client system
US7913161B2 (en) Computer-implemented methods and systems for electronic document inheritance
US20160170719A1 (en) Software database system and process of building and operating the same
US20050160104A1 (en) System and method for generating and deploying a software application
US8701083B2 (en) Systems and methods for varying software build properties using primary and supplemental build files
US20070073724A1 (en) System and method for automatic or semi-automatic software integration
Ahmad et al. A framework for architecture-driven migration of legacy systems to cloud-enabled software
CN111784108B (en) Modeling method and device of main data management platform
CN110544092B (en) Dynamic newly-added multi-type database data operation chaining method for block chain
US20080040418A1 (en) Accessing existing data using a service oriented architecture gateway
US20060047723A1 (en) Custom database system and method of building the same
CN112860260A (en) Web-based cross-platform application construction tool and method in college scene
US20050028139A1 (en) Information processing method, apparatus and program in XML driven architecture
CN112463149A (en) Software-defined satellite-oriented reusable code library construction method and device
KR101552914B1 (en) Web server application framework web application processing method using the framework and computer readable medium processing the method
CN114546563A (en) Multi-tenant page access control method and system
US20100011018A1 (en) Custom database system and method of building the same
JP5377522B2 (en) Efficiently correlate nominally incompatible types
US20080022258A1 (en) Custom database system and method of building and operating the same

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