CN105701218A - Method for realizing data synchronism of different terminals on database - Google Patents

Method for realizing data synchronism of different terminals on database Download PDF

Info

Publication number
CN105701218A
CN105701218A CN201610023490.6A CN201610023490A CN105701218A CN 105701218 A CN105701218 A CN 105701218A CN 201610023490 A CN201610023490 A CN 201610023490A CN 105701218 A CN105701218 A CN 105701218A
Authority
CN
China
Prior art keywords
data
database
chronization
action type
different terminals
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201610023490.6A
Other languages
Chinese (zh)
Other versions
CN105701218B (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

The invention discloses a method for realizing data synchronism of different terminals on a database. The method comprises the steps of step 1, locally marking and storing the added, deleted and modified data by a data operating end; step 2, uploading the locally stored data from the data operating end to an .NET Web server side; step 3, enabling the .NET Web server side to write the data into a temporary table of the database in batches; and step 4, enabling the database to synchronizing the data from the temporary table into a formal table. According to the method, differentiated data synchronism updating is adopted to prevent the data chaos in data management when multiple terminal devices are logged based on a same account, so that convenient data management and maintenance is realized.

Description

Realize the method that different terminals carries out data syn-chronization on the database
Technical field
The present invention relates to data synchronization service technical field, be specifically related to a kind of method Tong Bu with the batch data of MSSQL based on .NETweb service。
Background technology
Along with the fast development of network technology, Web service technology is very ripe, the Web service that order first three is conventional: RPC-remote process formula is called, SOA-Enterprise SOA and REST-characterize State Transferring and be obtained for well development and use。
Data base is requisite data management platform in platform development, and current spendable database platform has a lot, and toy data base system has Foxpro, ACCESS, PARADOX etc., and large-scale database system has DB2, ORACLE, SYBASE, SQLSERVER etc.。
Along with the development that mobile phone, PC etc. are locally stored, different terminals is when sharing a kind of account, local cache is different due to the time sequencing uploading platform, may result in situation about causing confusion in data management, it is necessary to realize data and upload and data are managed and safeguard by administrative mechanism。
Summary of the invention
Instant invention overcomes the deficiencies in the prior art, it is provided that a kind of realize the method that different terminals carries out data syn-chronization on the database, for solving different terminals when sharing a kind of account, it is possible to cause the technical problem caused confusion in data management。
Consider the problems referred to above of prior art, according to an aspect disclosed by the invention, the present invention by the following technical solutions:
A kind of realizing the method that different terminals carries out data syn-chronization on the database, it includes:
Step 1, by data manipulation end increase, delete, amendment data in this locality respectively carry out indicate storage;
Step 2, data locally stored for data manipulation end are uploaded to .NETWeb service end;
Step 3, described .NETWeb service end are again by the interim table of batch data write into Databasce;
Step 4, data base are by the data syn-chronization in interim table to formal table。
In order to realize the present invention better, further technical scheme is:
According to one embodiment of the invention, it also includes: after step 5, described .NETWeb service end acquisition data base performs result, result is packaged processing by described .NETWeb service end, then result returns to data manipulation end and is shown。
According to another embodiment of the invention, increasing Id, action type and operating time in formal table in the database and interim table, described action type is divided into increases, amendment and deletion。
According to another embodiment of the invention, described step 1 includes:
For the new content of data manipulation end, not storing Id and indicate, preserve data item, action type and operating time, action type is denoted as increase;
For the amendment content of data manipulation end, storage Id indicates, and preserves data item, action type and operating time, and action type is denoted as amendment;
For the deletion content of data manipulation end, storage Id indicates, and preserves data item, action type and operating time, and action type is denoted as deletion。
According to another embodiment of the invention, described .NETWeb service end passes through SqlBulkCopy method by the interim table of batch data write into Databasce。
According to another embodiment of the invention, described data base adopts MSSQL data base。
The present invention it may also is that
According to another embodiment of the invention, data include in the step of described MSSQL database purchase:
1) inquire about the record that all Id in interim table are sky, the record that described Id is empty is inserted in formal table;
2) inquiring about Id in interim table for empty record, according to Id, carry out the inquiry of Id in formal table, if not this Id in formal table, then inserting this recorded in formal table, if there being this Id in formal table, then performs following steps 3);
3) judge the action type of field in interim table, if amendment, then according to Id, update the recorded content of corresponding Id in formal table;If deleting, then according to Id, delete record corresponding for this Id in formal table。
Compared with prior art, one of beneficial effects of the present invention is:
The a kind of of the present invention realizes the method that different terminals carries out data syn-chronization on the database, it is based on .NETweb service and MSSQL data base, realize different terminals data are uploaded reception by web services, it is being analyzed uploading data by the administrative mechanism of data base, the data synchronization updating of differentiation is carried out finally according to the different pieces of information processing method uploaded, thus avoiding multiple terminal unit to share the situation that an account causes confusion in data management, facilitate administering and maintaining data。
Accompanying drawing explanation
For clearer explanation present specification embodiment or technical scheme of the prior art, below the accompanying drawing used required in the description to embodiment or prior art is briefly described, apparently, the accompanying drawing that the following describes is only to the reference of some embodiments in present specification, for those skilled in the art, when not paying creative work, it is also possible to obtain other accompanying drawing according to these accompanying drawings。
Fig. 1 is the system composition schematic diagram of data syn-chronization according to an embodiment of the invention。
Fig. 2 is data synchronization processing schematic flow sheet according to an embodiment of the invention。
Detailed description of the invention
Below in conjunction with embodiment, the present invention is described in further detail, but embodiments of the present invention are not limited to this。
As it is shown in figure 1, a kind of batch data synchronization scenario based on .NETweb service with MSSQL forms, mainly it is made up of data manipulation end (PC end, cell-phone customer terminal) .NETWeb service end, MSSQL data base three part。
Data manipulation end: data manipulation end (PC, mobile phone etc.) is the instrument producing and carrying out data modification, user is carried out the increasing of data by data manipulation end, delete, changes, is looked into, when user-selected number is according to when uploading, calls web service interface, upload data and carry out data syn-chronization。
.NETWeb service end: web services end provides web services on network, calls for cell-phone customer terminal。After getting the data that cell-phone customer terminal is uploaded, by the SqlBulkCopy method of .NET by the interim table of batch data write into Databasce, after write completes, call the storing process that MSSQL data base provides, the data of the data of interim table Yu formal table are merged。
MSSQL data base: MSSQL data base preserves data on the one hand, on the other hand, it is provided that data channel carries out database manipulation for web services end。
As shown in Figure 2, Fig. 2 is data synchronization processing schematic flow sheet according to an embodiment of the invention, data syn-chronization scheme is mainly built table, data manipulation end processing locality by data base, web services processes, four key steps of database manipulation form, and detailed step is as follows:
Step 1 is for the tables of data needing synchronization, need to set up two field name tables identical with type, one table is as formal table (following Table A), one table is as the interim table (such as following table B) write, structure needs except the data item of Data Sheet Design itself increase following field, Id: indicate from increasing field;EditType: record action type (increase, delete, change);EditTime: operating time。Wherein the Id of interim table is not from increasing field, it is possible to arbitrarily write 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 ephemeral data table
Id (non-self increasing) paraA paraB editType editTime
2 P7 P8 update
3 P5 P6 delete
4 P9 P10 insert
Step 2 user, after data are operated by cell-phone customer terminal or PC, preserves data content in this locality。If being new content, not storing Id and indicating, only preserve data item and editType (increase), editTime;If for amendment content, Id indicates and remains unchanged, and preserves data item and editType (amendment), editTime;
If for amendment content, Id indicates and remains unchanged, and preserves 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, by SqlBulkCopy method by the interim table of batch data write into Databasce。
Step 5web is called the storing process of MSSQL data base, is processed by database statement after servicing write data success, and by the data syn-chronization in interim table to formal table, storing process detailed process steps is as follows:
1) inquire about the record that all Id in interim table are sky, be inserted in formal table。
2) inquiring about Id in interim table is not empty record, according to Id, carries out the inquiry of Id in formal table, without this Id, then inserts this and recorded in formal table。Change Id if had, then perform to operate below。
3) judge the type of field editType in interim table, if update (amendment), then according to Id, update the recorded content of corresponding Id in formal table;If delete (deletion), then according to Id, delete record corresponding for this Id in formal table。
Step 6 storing process returns and performs result to web services。
Step 7web service returns result, encapsulation of data according to database store process, returns to the data manipulation end of user。
Step 8 data manipulation end returns result according to web services and result is shown。
In this specification, each embodiment adopts the mode gone forward one by one to describe, and what each embodiment stressed is the difference with other embodiments, identical similar portion cross-reference between each embodiment。
" embodiment ", " another embodiment ", " embodiment " spoken of in this manual, etc., refer to the specific features, structure or the feature that describe in conjunction with this embodiment and include at least one embodiment that the application generality describes。Multiple local appearance statement of the same race is not necessarily refer to same embodiment in the description。Furthermore, it is understood that when describing a specific features, structure or feature in conjunction with any embodiment, what advocate is also fall within the scope of the present invention to realize this feature, structure or feature in conjunction with other embodiments。
Although reference be made herein to invention has been described for the multiple explanatory embodiment of the present invention, but, it should be understood that those skilled in the art can be designed that a lot of other amendments and embodiment, these amendments and embodiment will drop within spirit disclosed in the present application and spirit。More specifically, in disclosure and scope of the claims, it is possible to building block and/or layout to theme composite configuration carry out multiple modification and improvement。Except the modification that building block and/or layout are carried out and improvement, to those skilled in the art, other purposes also will be apparent from。

Claims (7)

1. one kind realizes the method that different terminals carries out data syn-chronization on the database, it is characterised in that it includes:
Step 1, by data manipulation end increase, delete, amendment data in this locality respectively carry out indicate storage;
Step 2, data locally stored for data manipulation end are uploaded to .NETWeb service end;
Step 3, described .NETWeb service end are again by the interim table of batch data write into Databasce;
Step 4, data base are by the data syn-chronization in interim table to formal table。
2. according to claim 1 realize the method that different terminals carries out data syn-chronization on the database, it is characterized in that it also includes: after step 5, described .NETWeb service end acquisition data base performs result, result is packaged processing by described .NETWeb service end, then result returns to data manipulation end and is shown。
3. according to claim 1 realize the method that different terminals carries out data syn-chronization on the database, it is characterized in that increasing in formal table in the database and interim table Id, action type and operating time, described action type is divided into increase, amendment and deletes。
4. according to claim 3 realize the method that different terminals carries out data syn-chronization on the database, it is characterised in that described step 1 includes:
For the new content of data manipulation end, not storing Id and indicate, preserve data item, action type and operating time, action type is denoted as increase;
For the amendment content of data manipulation end, storage Id indicates, and preserves data item, action type and operating time, and action type is denoted as amendment;
For the deletion content of data manipulation end, storage Id indicates, and preserves data item, action type and operating time, and action type is denoted as deletion。
5. according to claim 1 realize the method that different terminals carries out data syn-chronization on the database, it is characterised in that described .NETWeb service end by SqlBulkCopy method by the interim table of batch data write into Databasce。
6. according to claim 1 realize the method that different terminals carries out data syn-chronization on the database, it is characterised in that described data base adopts MSSQL data base。
7. according to claim 6 realize the method that different terminals carries out data syn-chronization on the database, it is characterised in that data include in the step of described MSSQL database purchase:
1) inquire about the record that all Id in interim table are sky, the record that described Id is empty is inserted in formal table;
2) inquiring about Id in interim table for empty record, according to Id, carry out the inquiry of Id in formal table, if not this Id in formal table, then inserting this recorded in formal table, if there being this Id in formal table, then performs following steps 3);
3) judge the action type of field in interim table, if amendment, then according to Id, update the recorded content of corresponding Id in formal table;If deleting, then according to Id, delete record corresponding for this Id in formal table。
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 true CN105701218A (en) 2016-06-22
CN105701218B 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)

Cited By (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
CN106339408A (en) * 2016-08-10 2017-01-18 深圳中兴网信科技有限公司 Data synchronization method, data synchronization device 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
CN110209534A (en) * 2019-06-14 2019-09-06 四川长虹电器股份有限公司 The system and method for automated back-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 (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040064488A1 (en) * 2002-09-30 2004-04-01 Dinesh Sinha Real time optimized backup of computer data
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

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040064488A1 (en) * 2002-09-30 2004-04-01 Dinesh Sinha Real time optimized backup of computer data
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

Cited By (8)

* 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
CN106339408A (en) * 2016-08-10 2017-01-18 深圳中兴网信科技有限公司 Data synchronization method, data synchronization device and server
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
CN110209534A (en) * 2019-06-14 2019-09-06 四川长虹电器股份有限公司 The system and method for automated back-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

Also Published As

Publication number Publication date
CN105701218B (en) 2019-05-07

Similar Documents

Publication Publication Date Title
CN105701218A (en) Method for realizing data synchronism of different terminals on database
US9336227B2 (en) Selective synchronization in a hierarchical folder structure
KR101706252B1 (en) Method, server and computer program stored in computer readable medium for synchronizing query result
US9792340B2 (en) Identifying data items
CN110362632B (en) Data synchronization method, device, equipment and computer readable storage medium
CN103345521B (en) A kind of method and apparatus processing key assignments in Hash table database
CN104737135B (en) The information processing terminal and synchronisation control means
CN106657174A (en) Data synchronizing and updating methods and data synchronizing and updating devices
JP2016505930A (en) System, method, and apparatus for collaborative CAX editing
TW201433930A (en) File tracking methods and network communication devices using the same
JP2016503551A (en) Synchronization method, master device and slave device
WO2013075427A1 (en) Data update information obtaining method and device, and data synchronization method and device
CN102291453B (en) Data synchronization method and device
CN104504010B (en) The data collecting system and its acquisition method of a kind of multi-to-multi
CN102186163B (en) Data synchronizing method of multi-account address book of smart phone
CN105005499B (en) Multi-client collaboration grouping and display methods
KR101797483B1 (en) Technique for processing query in database management system
JP3756349B2 (en) Database management apparatus and recording medium on which program is recorded
CN105915636B (en) A kind of synchronous method and device of contact information
CN108897863A (en) Method of data synchronization and its system and server cluster
CN108009053A (en) The management of smart mobile phone core data and cloning process
CN103327480A (en) Intelligent mobile phone multiple-account contact information synchronizing method
CN107656992A (en) Towards the snapshot method for edition management in more insertion sources
KR20170101835A (en) Method, server and computer program stored in computer readable medium for synchronizing query result
CN105389316A (en) File management system and method

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