CN105701218B - Realize that different terminals carry out the synchronous method of data on the database - Google Patents

Realize that different terminals carry out the synchronous method of data on the database Download PDF

Info

Publication number
CN105701218B
CN105701218B CN201610023490.6A CN201610023490A CN105701218B CN 105701218 B CN105701218 B CN 105701218B CN 201610023490 A CN201610023490 A CN 201610023490A CN 105701218 B CN105701218 B CN 105701218B
Authority
CN
China
Prior art keywords
data
database
formal
web service
interim
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
CN201610023490.6A
Other languages
Chinese (zh)
Other versions
CN105701218A (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.)
Sichuan Changhong Electric Co Ltd
Original Assignee
Sichuan Changhong Electric 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 Sichuan Changhong Electric Co Ltd filed Critical Sichuan Changhong Electric Co Ltd
Priority to CN201610023490.6A priority Critical patent/CN105701218B/en
Publication of CN105701218A publication Critical patent/CN105701218A/en
Application granted granted Critical
Publication of CN105701218B publication Critical patent/CN105701218B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • G06F16/275Synchronous replication

Abstract

Realize that different terminals carry out the synchronous method of data on the database the invention discloses a kind of, it includes the following steps: (1) that the data for increasing data manipulation end, deleting, modifying locally are carrying out mark storage respectively;The data that data manipulation end is locally stored are uploaded to .NET Web service end by step 2;Step 3 .NET Web service end are again by the interim table of batch data write-in database;Data in interim table are synchronized in formal table by step 4, database.The present invention is avoided in the case where the same Account Logon of multiple terminal devices the case where causing confusion in data management, is facilitated and managed and maintained to data by the data synchronization updating of differentiation.

Description

Realize that different terminals carry out the synchronous method of data on the database
Technical field
The present invention relates to data synchronization service technical fields, and in particular to a kind of based on .NET web services and MSSQL The synchronous method of batch data.
Background technique
With the fast development of network technology, Web service technology is very mature, the common Web service of mesh first three: RPC- remote process formula is called, SOA- Enterprise SOA and REST- characterization state conversion have all obtained good development With use.
Database is essential data management platform in platform development, and workable database platform has very at present More, toy data base system has Foxpro, and ACCESS, PARADOX etc., large-scale database system has DB2, ORACLE, SYBASE, SQL SERVER etc..
With the continuous development that mobile phone, PC etc. are locally stored, different terminals are local slow in the case where sharing a kind of account It deposits since the time sequencing for uploading platform is different, may cause the case where causing confusion in data management, need to realize a number Data are managed and are safeguarded according to upload and administrative mechanism.
Summary of the invention
The present invention overcomes the deficiencies in the prior art, providing a kind of realization different terminals, to carry out data on the database synchronous Method may cause the skill to cause confusion in data management for solving different terminals in the case where sharing a kind of account Art problem.
In view of the above problem of the prior art, according to one aspect of the present disclosure, the present invention uses following technology Scheme:
A method of realizing that different terminals carry out data on the database and synchronize, it includes:
Step 1, the data that data manipulation end is increased, deletes, modified locally are carrying out mark storage respectively;
The data that data manipulation end is locally stored are uploaded to .NET Web service end by step 2;
Step 3 .NET Web service end are again by the interim table of batch data write-in database;
Data in interim table are synchronized in formal table by step 4, database.
In order to which the present invention is better achieved, further technical solution is:
An embodiment according to the present invention, it further include: step 5 .NET Web service end obtain database After implementing result .NET Web service end is packaged processing to result, and processing result is then returned to data manipulation End is shown.
Increase Id, behaviour in another embodiment according to the present invention, formal table in the database and interim table Make type and operating time, the action type is divided into increase, modification and deletion.
Another embodiment according to the present invention, the step 1 include:
For the new content at data manipulation end, Id mark is not stored, saves data item, action type and operating time, Action type is denoted as increasing;
For the modification content at data manipulation end, Id mark is stored, saves data item, action type and operating time, behaviour Make type designation as modification;
For the deletion content at data manipulation end, Id mark is stored, saves data item, action type and operating time, behaviour Make type designation to delete.
Another embodiment according to the present invention .NET Web service end will be counted by SqlBulkCopy method The interim table of database is written according to batch.
Another embodiment according to the present invention, the database use MSSQL database.
The present invention may also is that
Another embodiment according to the present invention, data include: in the step of MSSQL database purchase
1) inquiring all Id in interim table is empty record, is that empty record is inserted into formal table by the Id;
2) inquiring Id in interim table is not empty record, according to Id, the inquiry of Id is carried out in formal table, if formal table In there is no the Id, then be inserted into this and be recorded in formal table, if there is the Id in formal table, execute following steps 3);
3) action type for judging field in interim table, then according to Id, updates in formal table if it is modification and corresponds to Id's Record content;If it is deletion, then according to Id, the corresponding record of the Id in formal table is deleted.
Compared with prior art, beneficial effects of the present invention first is that:
A kind of method realized different terminals and carry out data synchronization on the database of the invention, is taken based on .NET web Business and MSSQL database realize that the upload to different terminals data receives by web services, in the supervisor by database System is analyzed data are uploaded, and the data synchronization updating of differentiation is finally carried out according to the different data processing method of upload, An account is shared the case where causing confusion in data management so as to avoid multiple terminal devices, facilitates the management to data And maintenance.
Detailed description of the invention
Illustrate present specification embodiment or technical solution in the prior art in order to clearer, it below will be to embodiment Or attached drawing needed in the description of the prior art is briefly described, it should be apparent that, the accompanying drawings in the following description is only It is the reference to embodiments some in present specification, for those skilled in the art, what is do not made the creative labor In the case of, other attached drawings can also be obtained according to these attached drawings.
Fig. 1 is the system composition schematic diagram synchronous according to the data of one embodiment of the invention.
Fig. 2 is the data synchronization processing flow diagram according to one embodiment of the invention.
Specific embodiment
The present invention is described in further detail below with reference to embodiment, embodiments of the present invention are not limited thereto.
As shown in Figure 1, a kind of formed based on the batch data synchronization scheme of .NET web services and MSSQL, mainly by counting It is formed according to three operating side (end PC, cell phone client) .NET Web service end, MSSQL database parts.
Data manipulation end: data manipulation end (PC, mobile phone etc.) is the tool for generating and carrying out data modification, and user passes through number Carry out the increasing of data according to operating side, delete, change, look into, when user-selected number is according to uploading, call web service interface, upload data into Row data are synchronous.
.NET Web service end: web services end provides web services on network, calls for cell phone client.When getting After the data that cell phone client uploads, batch data is written to the interim table of database by the SqlBulkCopy method of .NET, After the completion of write-in, the storing process for calling MSSQL database to provide closes the data of the data of interim table and formal table And.
MSSQL database: on the one hand MSSQL database saves data and on the other hand provides data channel for web services End carries out database manipulation.
As shown in Fig. 2, Fig. 2 is the data synchronization processing flow diagram according to one embodiment of the invention, data are synchronous Scheme mainly builds table, data manipulation end processing locality, four web services processing, database manipulation key step groups by database At detailed step is as follows:
Step 1 needs to establish two field names and the identical table of type for synchronous tables of data is needed, and a table is made For formal table (following Table A), a table is as the table (such as following table B) being temporarily written, in addition to Data Sheet Design itself in structure It needs to increase following field other than data item, Id: being indicated from field is increased;EditType: record action type (increase, delete, changing); EditTime: operating time.Wherein the Id of interim table be not from increasing field, can any write-in value.
Table A formally uses table
Id (from increasing) paraA paraB editType editTime
1 P1 P2 insert
2 P3 P4 insert
3 P5 P6 insert
Table B temporary data table
Id (non-from increasing) paraA paraB editType editTime
2 P7 P8 update
3 P5 P6 delete
4 P9 P10 insert
Step 2 user is locally saving data content after cell phone client or PC operate data.If it is new Increase content, does not store Id mark, only save data item and editType (increase), editTime;If it is modification content, Id mark Show and remain unchanged, saves data item and editType (modification), editTime;
If it is modification content, Id mark is remained unchanged, and saves data item and editType (deletion), editTime;
Step 3 calls web services, and the data of data manipulation end processing locality and storage are uploaded to platform.
After step 4web service receives data, batch data is written by the interim of database by SqlBulkCopy method Table.
After step 5web service write-in data success, the storing process of MSSQL database is called, at database statement Reason, the data in interim table is synchronized in formal table, storing process detailed process steps are as follows:
1) inquiring all Id in interim table is empty record, is inserted into formal table.
2) inquiring Id in interim table is not empty record, and according to Id, the inquiry of Id is carried out in formal table, if should not Id is then inserted into this and is recorded in formal table.If there is changing Id, then operation below is executed.
3) type for judging field editType in interim table then according to Id, updates formal if it is update (modification) The record content of Id is corresponded in table;If it is delete (deletion), then according to Id, the corresponding record of the Id in formal table is deleted.
Step 6 storing process returns to implementing result to web services.
Step 7web service is returned the result according to database store process, and encapsulation of data returns to the data manipulation of user End.
Step 8 data manipulation end is returned the result according to web services is shown result.
Each embodiment in this specification is described in a progressive manner, the highlights of each of the examples are with it is other The difference of embodiment, the same or similar parts in each embodiment cross-reference.
" one embodiment " for being spoken of in the present specification, " another embodiment ", " embodiment ", etc., refer to tying Specific features, structure or the feature for closing embodiment description include at least one embodiment described in the application generality In.It is not centainly to refer to the same embodiment that statement of the same race, which occur, in multiple places in the description.Appoint furthermore, it is understood that combining When one embodiment describes a specific features, structure or feature, to be advocated be realized in conjunction with other embodiments it is this Feature, structure or feature are also fallen within the scope of the present invention.
Although reference be made herein to invention has been described for multiple explanatory embodiments of the invention, however, it is to be understood that Those skilled in the art can be designed that a lot of other modification and implementations, these modifications and implementations will fall in this Shen It please be within disclosed scope and spirit.It more specifically, within the scope of the present disclosure and claims, can be to master The building block and/or layout for inscribing composite configuration carry out a variety of variations and modifications.In addition to what is carried out to building block and/or layout Outside variations and modifications, to those skilled in the art, other purposes also be will be apparent.

Claims (3)

1. a kind of realize that different terminals carry out the synchronous method of data on the database, it is characterised in that it includes:
Step 1, the data that data manipulation end is increased, deletes, modified locally are carrying out mark storage respectively;
The data that data manipulation end is locally stored are uploaded to .NET Web service end by step 2;
Step 3 .NET Web service end are again by the interim table of batch data write-in database;
Data in interim table are synchronized in formal table by step 4, database;
Increase Id, action type and operating time, the action type point in formal table in the database and interim table For increase, modification and deletion;
The step 1 includes:
For the new content at data manipulation end, Id mark is not stored, saves data item, action type and operating time, operation Type designation is to increase;
For the modification content at data manipulation end, Id mark is stored, data item, action type and operating time are saved, operates class Type is denoted as modifying;
For the deletion content at data manipulation end, Id mark is stored, data item, action type and operating time are saved, operates class Type is denoted as deleting;
The database uses MSSQL database;The step of MSSQL database purchase includes:
1) inquiring all Id in interim table is empty record, is that empty record is inserted into formal table by the Id;
2) inquiring Id in interim table is not empty record, according to Id, the inquiry of Id is carried out in formal table, if do not had in formal table There is the Id, be then inserted into this and be recorded in formal table, if there is the Id in formal table, execute following steps 3);
3) action type for judging field in interim table, then according to Id, updates the record that Id is corresponded in formal table if it is modification Content;If it is deletion, then according to Id, the corresponding record of the Id in formal table is deleted.
2. according to claim 1 realize that different terminals carry out the synchronous method of data on the database, it is characterised in that It further include: after step 5 .NET Web service end obtain database implementing result .NET Web service end is to knot Fruit is packaged processing, and processing result is then returned to data manipulation end and is shown.
3. according to claim 1 realize that different terminals carry out the synchronous method of data on the database, it is characterised in that The interim table of database is written by SqlBulkCopy method by .NET Web service end for batch data.
CN201610023490.6A 2016-01-14 2016-01-14 Realize that different terminals carry out the synchronous method of data on the database Active CN105701218B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610023490.6A CN105701218B (en) 2016-01-14 2016-01-14 Realize that different terminals carry out the synchronous method of data on the database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610023490.6A CN105701218B (en) 2016-01-14 2016-01-14 Realize that different terminals carry out the synchronous method of data on the database

Publications (2)

Publication Number Publication Date
CN105701218A CN105701218A (en) 2016-06-22
CN105701218B true CN105701218B (en) 2019-05-07

Family

ID=56227328

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610023490.6A Active CN105701218B (en) 2016-01-14 2016-01-14 Realize that different terminals carry out the synchronous method of data on the database

Country Status (1)

Country Link
CN (1) CN105701218B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106156330A (en) * 2016-07-06 2016-11-23 北京金山安全管理系统技术有限公司 A kind of data base's adaptation method and database adapter
CN106339408B (en) * 2016-08-10 2019-08-23 深圳中兴网信科技有限公司 Method of data synchronization, data synchronization unit and server
CN109739936A (en) * 2019-01-23 2019-05-10 杭州数梦工场科技有限公司 Method of data synchronization, system, server and computer readable storage medium
CN109933596A (en) * 2019-02-27 2019-06-25 深圳市轱辘汽车维修技术有限公司 A kind of method of data synchronization, device and terminal device
CN110209534B (en) * 2019-06-14 2022-09-16 四川长虹电器股份有限公司 System and method for automatically backing up mysql database
CN110941615A (en) * 2019-11-25 2020-03-31 西安精雕软件科技有限公司 Distributed hierarchical CNC data acquisition and dump method and system
CN115391465A (en) * 2022-10-27 2022-11-25 天津睿智诚科技发展有限公司 Multi-terminal data synchronization method, system and device based on signal clustering judgment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103605776A (en) * 2013-11-28 2014-02-26 北京国双科技有限公司 Method and device for processing data of information database
CN103793482A (en) * 2014-01-16 2014-05-14 北京恒华伟业科技股份有限公司 Data synchronization method and system
CN104967658A (en) * 2015-05-08 2015-10-07 成都品果科技有限公司 Data synchronization method on multiple devices
CN105260485A (en) * 2015-11-20 2016-01-20 杭州数梦工场科技有限公司 Method and device for loading data
CN107071005A (en) * 2017-03-24 2017-08-18 厦门中控生物识别信息技术有限公司 A kind of method of data synchronization and system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7051053B2 (en) * 2002-09-30 2006-05-23 Dinesh Sinha Method of lazily replicating files and monitoring log in backup file system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103605776A (en) * 2013-11-28 2014-02-26 北京国双科技有限公司 Method and device for processing data of information database
CN103793482A (en) * 2014-01-16 2014-05-14 北京恒华伟业科技股份有限公司 Data synchronization method and system
CN104967658A (en) * 2015-05-08 2015-10-07 成都品果科技有限公司 Data synchronization method on multiple devices
CN105260485A (en) * 2015-11-20 2016-01-20 杭州数梦工场科技有限公司 Method and device for loading data
CN107071005A (en) * 2017-03-24 2017-08-18 厦门中控生物识别信息技术有限公司 A kind of method of data synchronization and system

Also Published As

Publication number Publication date
CN105701218A (en) 2016-06-22

Similar Documents

Publication Publication Date Title
CN105701218B (en) Realize that different terminals carry out the synchronous method of data on the database
WO2020237797A1 (en) Dynamic configuration management method and system in microservice framework
CN106997378B (en) Redis-based database data aggregation synchronization method
CN104052822A (en) Enterprise address list and instant message group automatic synchronization method and system
TWI502384B (en) File tracking methods and network communication devices using the same
CN106599104A (en) Mass data association method based on redis cluster
CN103345521B (en) A kind of method and apparatus processing key assignments in Hash table database
CN106933837A (en) A kind of database table model and creation method
CN109063196A (en) Data processing method, device, electronic equipment and computer readable storage medium
CN102906751A (en) Method and device for data storage and data query
CN104484469B (en) One kind supports more non-stop-machine expansion methods of hash map data base cluster systems
CN107463610B (en) Data warehousing method and device
CN105989076A (en) Data statistical method and device
CN104317957B (en) A kind of open platform of report form processing, system and report processing method
CN104834700A (en) Method for capturing movement data increment based on track change
CN102567820A (en) Dynamic news release and management system
CN103646051A (en) Big-data parallel processing system and method based on column storage
CN103761136A (en) Method for dynamically loading data model based on plug-in
CN111488340B (en) Data processing method and device and electronic equipment
CN102006156B (en) Method and system for synchronizing configuration data among boards
CN102411594A (en) Method and device for obtaining information
CN103605732A (en) Data warehouse, data warehouse system and data warehouse construction method based on Infobright
CN104052767A (en) File tracking method and network communication device with applicability of the same
CN115033646A (en) Method for constructing real-time warehouse system based on Flink and Doris
CN101882179B (en) Method and device for drawing topological graph

Legal Events

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