Solved

Database Replcation / Sync'ing

Posted on 2004-08-24
6
230 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
ID: 11880600
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
ID: 11883570
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
ID: 11886015
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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 1

Assisted Solution

by:Eamon21
Eamon21 earned 100 total points
ID: 11888190
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
ID: 11901867
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
ID: 12044109
I'm still sketchy on how to do this properly, but im sure all of these would work.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

856 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