Solved

Database Replcation / Sync'ing

Posted on 2004-08-24
6
226 Views
Last Modified: 2010-04-15
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
Comment
Question by:jvoros1
6 Comments
 
LVL 4

Assisted Solution

by:somnatic
somnatic earned 100 total points
Comment Utility
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
 

Author Comment

by:jvoros1
Comment Utility
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
 
LVL 1

Accepted Solution

by:
cdmackie earned 300 total points
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 1

Assisted Solution

by:Eamon21
Eamon21 earned 100 total points
Comment Utility
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
 

Author Comment

by:jvoros1
Comment Utility
Thanks for the help guys. I'm going to have to look into it. I'll divide up the points soon.
0
 

Author Comment

by:jvoros1
Comment Utility
I'm still sketchy on how to do this properly, but im sure all of these would work.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now