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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

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
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.