Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

How to keep Canadian and US customers database separate in their country Expand / Collapse
Author
Message
Posted Thursday, July 24, 2014 12:00 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, August 1, 2014 4:09 PM
Points: 3, Visits: 29
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
Post #1595978
Posted Thursday, July 24, 2014 12:41 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 11:23 PM
Points: 33,278, Visits: 15,449
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
Post #1595990
Posted Thursday, July 24, 2014 12:57 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Today @ 12:11 PM
Points: 961, Visits: 3,009
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
To properly post on a forum:
http://www.sqlservercentral.com/articles/61537/
Post #1595997
Posted Thursday, July 24, 2014 1:12 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, August 1, 2014 4:09 PM
Points: 3, Visits: 29
>>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.
Post #1596000
Posted Thursday, July 24, 2014 7:12 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 8:14 PM
Points: 37,107, Visits: 31,665
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."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1596061
Posted Friday, July 25, 2014 6:38 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, September 1, 2014 9:23 PM
Points: 23, Visits: 111
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.
Post #1596180
Posted Friday, July 25, 2014 9:19 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Today @ 12:11 PM
Points: 961, Visits: 3,009
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
To properly post on a forum:
http://www.sqlservercentral.com/articles/61537/
Post #1596276
Posted Friday, July 25, 2014 10:43 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, August 1, 2014 4:09 PM
Points: 3, Visits: 29
>>>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.
Post #1596317
Posted Friday, July 25, 2014 10:52 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 12:39 AM
Points: 3,136, Visits: 11,494
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.






Post #1596319
Posted Tuesday, July 29, 2014 8:54 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, September 15, 2014 2:36 PM
Points: 8, Visits: 43
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 !!


Post #1597336
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse