Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 249
  • Last Modified:

Database Replcation / Sync'ing

We have an application where users sign in like a punch clock. This punch clock is pretty simple, saves the sign in time and the sign out time.

The problem we are having is that if the server goes down for any reason no one can login or out, as it won't update the database.

Is there a way to save this data to a file on the local machine and when the network is avalible then it will sync with the database?

0
jvoros1
Asked:
jvoros1
3 Solutions
 
somnaticCommented:
only an idea ..

write the database calls (SQL Statements) into a file and every 5 minutes (or so) feed them to the database .. if the action was successfull, flush the file .. otherwise .. keep the file and append the rest and try again 5 minutes later ..
0
 
jvoros1Author Commented:
that might work... but i also have to read from the database as well (return user names) .. would i beable to query the database to a file, then read form the file and then reupdate?
0
 
cdmackieCommented:
SQL Server?

If so, then it provides in built replication and synchronization capabailities where you can have a mixture of publisher/distributor/merge type databases.

Suggest you start with the Replication help in the manuals/books on-line to get the general feel. Then you can go about setting up your replication tables (in the 'Publisher') and assign your clients (the 'Subscribers'). There are also several models, and perhaps something to keep everything fully-synchronized would be best for you app - depending on the number of clients, etc.

To start, go into Enterprise Manager, Replication, Publications and right-click to create a new publication.

A word of warning, though, it can be a hair-pulling experience because the servers have to be set up right...it'll either work straight-away or not at all and you won't know why!!!...from bitter expereince, but I can help you later with some tips!


Colin
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Eamon21Commented:
Why not create a dataset with the same structure as your database, when the program loads, it can read/refresh the dataset from the server if it is available.  You can then use the dataset as an in-memory copy of the database and when changes are made, attempt tp update back to the server.  If this fails, the changes will still be marked in the dataset as added, modified or deleted rows.  When the program shutsdown, you can then use DataSet.WriteXML() function to persist it to local disk.  To ensure that the rowstates are saved, use System.Data.XmlWriteMode.DiffGram as the write mode.

Next time the program starts, create a new dataset and ReadXML() from this file, if the server is available, you can update now and any previous changes will be sent to the server.

Eamon
0
 
jvoros1Author Commented:
Thanks for the help guys. I'm going to have to look into it. I'll divide up the points soon.
0
 
jvoros1Author Commented:
I'm still sketchy on how to do this properly, but im sure all of these would work.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now