Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How to keep Canadian and US customers database separate in their country


How to keep Canadian and US customers database separate in their country

Author
Message
ChrisSut
ChrisSut
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
Points: 4 Visits: 32
We have a need to keep MS SQL server data of users in their country, USA and Canada. We have servers in both country. We have a single web application that need to manage data for both and it has to be seamless. I don't want users to direct to separate country specific sub domains like http://ca.mysite.com and http://us.mysite.com. What would it take to achieve this? My front end web application is hosted in USA.

What technologies do I need to know so that I can explore more? Is it something related to distributed transaction concept or some other useful features/tools are available in MS SQL server? Also, do you know if having VPN between 2 servers will help with the performance of the application when data is fetched from 2 servers?

Chris
Steve Jones
Steve Jones
SSC-Dedicated
SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)

Group: Administrators
Points: 36308 Visits: 18752
How will you tell where to send data? How can you tell if a user is from a country?

You can certainly use something like bidirectional transaction replication to move data. You can also use Service Broker to build two one-way pipes, though preventing loops of changes can be an issue there.

The VPN doesn't necessarily improve performance, and can hurt it. It's more about security.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Michael L John
Michael L John
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2056 Visits: 7404
Number one, you need to become very good friends with your network people!

Where are the user names and passwords stored? If they can be stored in the USA database, and your network bandwidth, security, etc. etc. allow it, the simple answer is as follows:

1. Store the users and passwords in the USA database.
2. When the user logs on, determine if they are a Canadian or American user.
3. If Canadian, then use a connection string that connects to the Canadian database.
4. If American, then use a connection string that connects to the USA database.

This is overly simplified, there are a number of questions that need to be asked of your network people.

Michael L John
If you assassinate a DBA, would you pull a trigger?
To properly post on a forum:
http://www.sqlservercentral.com/articles/61537/
ChrisSut
ChrisSut
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
Points: 4 Visits: 32
>>How will you tell where to send data? How can you tell if a user is from a country?

This will be part of the sign up process and saved in USA database.
Jeff Moden
Jeff Moden
SSC-Forever
SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)

Group: General Forum Members
Points: 45311 Visits: 39934
If you have database servers in each country, I believe that you're missing a prime opportunity for disaster recovery. All customers should be in the same database and the database should, obviously, be able to discriminate by the customer as to which country's information they should have access to. For Canada especially, there should also be a language preference.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Wink

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
MarbryHardin
MarbryHardin
SSC Rookie
SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)

Group: General Forum Members
Points: 29 Visits: 153
Well, the simplest way would seem to be to just duplicate the SQL structure and code then have the application use an appropriate connection string depending on which country the user is from. Whenever you take that approach you need to make sure that it's somewhat locked down to ensure each instance stays in sync as far as code changes in SQL though.

If the data only needs to be in its respective country, not necessarily completely separate, you might use the US DB as the "master" since that's where your site is hosted. Then just replicate the Canadian data to the SQL instance there like what Steve suggested. Or just replicated all of it and have a backup if that's not an issue.
Michael L John
Michael L John
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2056 Visits: 7404
A few more questions.

Is there common data between the two databases that needs to be in sync? Or, is this data completely separate?

If there is data that needs to be synced, does some of it need to be real time, and some of it can be synced on a schedule? This may simplify things.

Are these servers in the same domain, or, trusted domains? Or are they completely separate boxes? The VPN question makes me think that there is no physical connection between these servers.

Why do the different databases need to be in two different countries? If this is a web app, there is nothing stopping you from having these databases in the same physical location. They can even be on the same server.

I had a similar situation where the application and database lived in the United States, and the application users were in China. The original plan was to implement a second server and bi-directional transactional replication. We threw that out, and had the users in China connect directly to the app in the US. We then implemented transactional replication as well as snapshot replication from the US to China. A separate "read only utility" application was created so that the China users could read the replicated data instead of pulling significant amounts of data over the VPN connection.

Jeff's suggestion to use this as an opportunity to implement DR should also be taken into consideration. Some higher level assistance will likely be required.

Michael L John
If you assassinate a DBA, would you pull a trigger?
To properly post on a forum:
http://www.sqlservercentral.com/articles/61537/
ChrisSut
ChrisSut
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
Points: 4 Visits: 32
>>>Why do the different databases need to be in two different countries?

This is a legal requirement, we cannot keep health records of US citizens in Canada or health records of Canadians in USA.
Michael Valentine Jones
Michael Valentine Jones
Hall of Fame
Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)

Group: General Forum Members
Points: 3264 Visits: 11771
ChrisSut (7/25/2014)
>>>Why do the different databases need to be in two different countries?

This is a legal requirement, we cannot keep health records of US citizens in Canada or health records of Canadians in USA.



I have seen non-US clients require that their data be stored outside of the US to prevent it from being subject to the Patriot Act.

In practice, I doubt that would help if the entity hosting the data is a US company. They would simply turnover the data stored on the foreign servers if they were presented with a search warrant.
ajay 44186
ajay 44186
Forum Newbie
Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: General Forum Members
Points: 8 Visits: 47
Here is the simples solution:

1. Have two separate databases and two separate web servers servicing the requests
2. Have the users login to a third common website
3. Redirect the users to the appropriate website once authenticated and location is known.

Always try and keep your web apps as close to the database as possible. Reduce latency.

Let me know if that makes sense.
Good Luck !!
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search