C# .NET - DB Synchronization in c#

Asked By shanti k
27-Oct-09 06:10 AM

Hi All,

 

Can anyone provide the complete code for Data Base Synchronization in c#.

the requirement is we have two servers at different places when ever we insert a new record or update anything in one server that should be updated in other server automatically located at different place.

Regards,

Shanthi.

  Vasanthakumar D replied to shanti k
27-Oct-09 06:18 AM

Hi,

you can use Replication option for this in Sql server.

check here for more details...

http://www.exforsys.com/tutorials/sql-server-2005/sql-server-configuring-replication.html

http://databases.about.com/cs/sqlserver/a/aa041303a.htm

Re  Re

27-Oct-09 06:23 AM
You can opt to write a Windows service for this synchronization Job. 
If your are using SQL Server then you can also look into using SQL Mirroring.

Replication  Replication

27-Oct-09 06:29 AM
Rather than creating an app to synchronize, depending on your scenario consider implementing one of these SQL Server 2000 Replication techniques to get your job done automatically  -
Snapshot replication:  http://www.mssqlcity.com/Articles/Replic/SetupSR/SetupSR.htm
Transactional replication: http://www.mssqlcity.com/Articles/Replic/SetupTR/SetupTR.htm
Merge replication: http://www.mssqlcity.com/Articles/Replic/SetupMR/SetupMR.htm

You can configure a Replication technique according to your precise requirements.

Read more about Replication here -
http://databases.about.com/cs/sqlserver/a/aa041303a.htm
http://www.code-magazine.com/Article.aspx?quickid=0311101
reply  reply
27-Oct-09 06:35 AM
Hi,
SQL Server 2005 - Configuring Replication

In this tutorial you will learn about SQL Server 2005 - Configuring Replication - New Types of Replication, Peer to Peer Transactional Replication, HTTP Replication, Configuring Replication Configuring Replication Using RMO, Referencing the RMO and SMO libraries and Creating a Subscription Using RMO.


New Types of Replication

New types of replications have been introduced in SQL Server 2005. The first of these is the Heterogeneous Replication which allows the publication of data from heterogeneous subscribers such as Oracle, DB2 using relevant ODBC drive and OLE DB provider. In SQL Server 2005 allows configuration of the snapshot and transaction replication without requiring additional software. The second type is the Snapshot replication from an oracle publisher. This requires the publisher to generate a set of data and the transfer of such data to the subscriber. When oracle is used the SQL Server connects to the Oracle database and retrieves the data without needing a change tracking or insertion of information into the Oracle database. Transactional replication requires that each transaction made to the data at the publisher is tracked, so that it can be replicated to subscribers. While configuring an Oracle publisher from the SQL Server triggers are added to replicate tables created in Oracle for each published table.

Peer to Peer Transactional Replication

The concept of Peer to peer transactional replication is used to increase the server scale out capabilities. All nodes within the system are treated as peers and can be updated simultaneously. Each node has its own Log Reader Agent and Distribution Agent. Therefore, a node can be taken offline for scheduled maintenance without impact on performance and put online again and logs from other nodes can be applied to it.

HTTP Replication

SQL Server 2005 introduces Web synchronization for merge replication and provides the user with the ability to replicate directly over an HTTP or HTTPS connection. This solution will be appreciated by mobile users. The Internet Information Services are used to transfer data between the publisher and the subscriber and subscribers connect to a URL on the web server using authentication parameters configured in the subscription. The messages sent are packaged as XML and encrypted using Secure Socket Layer for security. The IIS communicates in a binary format with the publisher over a TCP/IP network connection. Since HTTP replication is merge replication technology, updates can be made both to rows at both the subscriber and publisher ends. Since the subscriber is mobile, the merge agent runs on the subscriber and configures only pull subscriptions. The synchronization can be configured to run continuously, on schedule or on demand. Subscription is initialized at the subscriber end by a snapshot generated at the publisher and transferred to the subscriber. In Web synchronization the snapshot is delivered as an attachment over HTTP.

For more detail check this links:
http://msdn.microsoft.com/en-us/library/ms151198.aspx
http://www.exforsys.com/tutorials/sql-server-2005/sql-server-configuring-replication.html

Create New Account
help
SSIS / DTS with SQL Server 2000? SQL Server I am working with a SQL Server 2005 client while the server still runs SQL Server 2000. SQL Server 2000 had DTS while 2005 has SSIS. Given
SQL server 2000 SQL Server Does Microsoft still support SQL server 2000? SQL Server New Users Discussions SQL Server (1) SQL Server Books Online (1) SQL server
Attach SQL Server 2008 database to SQL Server 2000 Server SQL Server Hi, I have created a database in SQL Server 2008, with compatibility level of SQL
SQL Server 2000 SQL Server Are there any compatability issues with SQL Server 2000 Enterprise edition and Server 2003 standard with SP2? SQL Server Discussions SQL Server 2000 (1
Problem upgrade sql server 6.5 to sql server 2000 enterprise edition on Windows 2000 Server SQL Server Hello, I have problems with upgrade sql server 6.5 to sql server 2000