Link to home
Start Free TrialLog in
Avatar of emi_sastra
emi_sastra

asked on

SINKRON DATA BETWEEN SITES

Hi All,

I have two sites, and using the same application.
Now, we have two servers, HO and Warehouse at different site.

What should I do to sync data between them instantly using application ?
I mean every transaction inputed at Warehouse will directly effect to server at HO ?

Thank you.
Avatar of Alpesh Patel
Alpesh Patel
Flag of India image

Hi Database structure is same then use single database.

otherwise if have access of both SQL server then transfer data using SSIS package from one server to another server.
Avatar of emi_sastra
emi_sastra

ASKER

Hi PatelAlpesh,

The database structures are the same.

I want to sync it using application directly every transaction.

How could I do it ?

Thank you
hi  if you have 2 server located in different use can use replication,where both the servers are available,
if you want to use the secondary server for readonly purpose you can use easy and best way log shipping,, you can also use linked servers to have data syncronisation
The servers are in different which is just could be connected using internet.

Both server are production server and use the same application.

Which method is suitable for this.

Thank you.
There are two options

1) Every SQL that you execute on one server, execute it on the other as well (using two different connection strings). But if the link between the two servers is internet then the app will be slow. But you can work around that by queueing the SQL statements and running a separate thread for executing these against the distant server.

2) Use SQL Server Replication. Once you configure it correctly, SQL Server will manage the synching itself.
Hi CodeCruiser,

1. It is interesting, how to queueing the SQL statement using VB Code ?

1, 2. How to configure to to make it link ?

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
For 1: Would you please more specific or sample how it works.

For 2: I will learn it.

Thank you.
Ok. Add a

            Dim q As New Queue(Of String)

in a Module. Whenever you execute a SQL Query, use this

q.Enqueue("the sql command")


Now you are creating a Queue of sql commands. You can add a timer and a backgroundworker to the main form. When the timer ticks (whatever interval you set), run the backgroundworker if its not already running. In the backgroundworker, use the q.DeQueue and then use the usual sql objects (connection, command) to run the query.
Let me describe what I get:

1. Every transaction happened, I write it to a textfile for queueing ?

2. Using timer to read the textfile and execute it using sql command?

Thank you.
>I write it to a textfile for queueing ?

You can use a text file but i used a Queue(of String) in the example above.
Ok, I will learn it.

Thank you very much for your help.
Glad to help :-)