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.
LVL 1
emi_sastraAsked:
Who is Participating?
 
CodeCruiserCommented:
For 1: You can use any mechanism such as a table in local DB or a List(of String) in a module or even a txt file.

For 2:
http://www.databasejournal.com/features/mssql/article.php/1438201/Setting-Up-Transactional-Replication-A-Step-by-step-Guide.htm

http://www.cryer.co.uk/brian/sqlserver/howtoreplication.htm

0
 
Alpesh PatelAssistant ConsultantCommented:
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.
0
 
emi_sastraAuthor Commented:
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
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
Ramesh Babu VavillaCommented:
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
0
 
emi_sastraAuthor Commented:
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.
0
 
CodeCruiserCommented:
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.
0
 
emi_sastraAuthor Commented:
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.
0
 
emi_sastraAuthor Commented:
For 1: Would you please more specific or sample how it works.

For 2: I will learn it.

Thank you.
0
 
CodeCruiserCommented:
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.
0
 
emi_sastraAuthor Commented:
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.
0
 
CodeCruiserCommented:
>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.
0
 
emi_sastraAuthor Commented:
Ok, I will learn it.

Thank you very much for your help.
0
 
CodeCruiserCommented:
Glad to help :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.