• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

dynamically decide which database has to be referred

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all ,
we have developed an application called document management system which has been developed using spring and hibernate , now we want give this application on trial basis to the clients. to do so what we have done is we have created separate database for each client , User while logging in will be giving his user name and password along with client id based on client id i have to refer the database .
(for example i have created two databases with the names AAA and BBB and restored these databases with our application database, while user logging if he gives client id as AAA then the database named AAA has to be refer ed for all his transactions ,if the client id is BBB then database BBB has to be referred , these databases schema and all the stored procedures will be same but data will be based on clients )

how to dynamically decide which database has to be referred in hibernate.


with regards,
bukka pavan kumar.
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If its a web app and my company got more money, then I might deployed separate instance of webapp for each client and configured the db accordingly, then it just a matter of sub-dimain pointing correct app, like http://aaa.dms.com or http://bbb.dms.com

Still for your problem, this blog may help: http://blog.springsource.org/2007/01/23/dynamic-datasource-routing/
 
pavan bukka
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for your reply

with regards,
b pavan kumar.
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't want to have a separate webapp for each client because if your application is mostly database oriented, the load on your webapp server is going to be much lesser than the load on the database server. The cost of the webapp server, and more importantly the labor cost of maintaining the server will be a big waste

This kind of model where you want to support multiple clients in your SaaS app is called multi tenancy. There are various multi tenancy models. This whitepaper does a good job of covering the various multi tenancy models
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The cloud way its indeed a cool idea, I haven't thought of that. Thanks.

Also, deploying multiple app is bad idea as number of client grows, the cost and maintenance is real pain. I took my words back on that.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic