none
Application working with more than one database RRS feed

  • Question

  • Application working with more than one database

    We need to design a web application that points more than one database in different regions inside the country and/or our outside the country. Anybody can point me to right direction on how to realize the type of implementation?


    JIM.H.
    Tuesday, November 22, 2011 3:52 PM

All replies

  • Application working with more than one database

    We need to design a web application that points more than one database in different regions inside the country and/or our outside the country. Anybody can point me to right direction on how to realize the type of implementation?


    JIM.H.
    • Merged by Peja Tao Thursday, November 24, 2011 6:39 AM duplicate
    Tuesday, November 22, 2011 3:55 PM
  • Can you rephrase your question and include more conceptual details?

    Tuesday, November 22, 2011 4:12 PM
  • Thank you for the reposne. How can we architect the following scenario:

    1.     The client wants only one web application that their employees can access anywhere in the world.

    2.     They have 3 locations that they can host web site and database servers. One in Brazil, one in China and another one in India.

    3.     When application is accessed in Brazil the data is read/written to database server in Brazil. If application is accessed in China the data is read/written to database server in China, if the application accessed anywhere else data is read/written to database server in India.

     


    JIM.H.
    • Edited by xyz_999 Tuesday, November 22, 2011 4:43 PM
    Tuesday, November 22, 2011 4:42 PM
  • So you need either some kind of replication or a high-availability solution.

     

    Tuesday, November 22, 2011 6:41 PM
  • Not really, the data needs to stay where it is originated, and no replication between them. How can I make the application intelligent enough to do this?


    JIM.H.
    Tuesday, November 22, 2011 7:27 PM
  • Why not simply using the URL as discriminator? br.yourdomain.tld, cn.yourdomain.tld and in.yourdomain.tld and hosting these in the corresponding countries.

    Tuesday, November 22, 2011 7:40 PM
  • So does it mean the web server is specific to the region also? If so then just include a region setting in the application so that it is one of the configuration parameters upon initial setup similar to how Windows has a locale setting. The setting will be persisted on disk to ensure it survives reboot, failover, etc... The rest is then dependent on how your application is designed.

    If it uses global strings to establish the database connection then it's a simple startup routine to set the correct global string. If connections are established on an ad hoc basis or independently then you'd have to make changes to each module to check for the applicatin's region setting and connect as appropriate.

     

    If the web servers are not dedicated to a region, you then have different paths available:

    • Group each locale into one of the three regions you have servers in and have the application detect locale info from the connecting client and decide which region's database server to connect to - the risk is a user with incorrect client locale settings or a visitor using his laptop will be connecting to some other region
    • Add a region tag to the user accounts and connect to the pre-assigned regional DB server - users will always connect to the specific region he/she is assigned to even when travelling but this implies some maintenance if users permanently migrates to a different region (minor work though)

     


    No great genius has ever existed without some touch of madness. - Aristotle
    Wednesday, November 23, 2011 12:47 AM
  • Thanks for the response. This is an Indian based client they want one specific URL and make decision in the back-end to choose what database to access based on where the application is accessed. We can tag the users based on their locations and forward them to specific web servers first and then related database. I am not sure witch path is best, one web server or 3 web servers. Do you have any experience if the application accesses database over WAN would this not be creating performance problem?


    JIM.H.
    Wednesday, November 23, 2011 2:14 PM
  • Thanks Joe for the response. Can you direct me to a specific site mentioning this, I can read into further. If we use different web servers we need to able to redirect users to the specific web server based on the location they access this web application.


    JIM.H.
    Wednesday, November 23, 2011 2:20 PM
  • Hello,

    Please, could you be more precise in your question ?

    Do you mean an application using for example a database for each region of a country ? So if you have 6 regions for a country, you will have 6 databases to use,maintain...Maybe difficult to maintain an application except if you accept to define an array with the names of your 6 databases and if you create methods accepting the name of the database as parameter

    Without any more explanations from you, it will be difficult to help you more efficiently.

    Have a nice day

     


    Mark Post as helpful if it provides any help.Otherwise,leave it as it is.
    Wednesday, November 23, 2011 11:38 PM
    Moderator
  • Hi JIM.H,

    You question has been answered in ASP/Net forum. You can create a Data Access Layer to control the access from Web application to the three Databases.


    Best Regards,
    Peja

    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    • Edited by Peja Tao Thursday, November 24, 2011 6:35 AM
    • Proposed as answer by Peja Tao Thursday, November 24, 2011 6:35 AM
    • Proposed as answer by Papy NormandModerator Thursday, November 24, 2011 11:56 PM
    • Edited by Papy NormandModerator Thursday, November 24, 2011 11:58 PM create instead creat , to clarify a useful reply
    Thursday, November 24, 2011 6:34 AM
  • Creating data access layer is not a problem, I am looking if anybody has any experience accessing database over WAN, should we expect any performance problem. The web server running in India will be accessing database in Brazil, any input?


    JIM.H.
    Friday, November 25, 2011 3:53 PM
  • Thanks for your input. one databse per country.
    JIM.H.
    Friday, November 25, 2011 3:54 PM