• 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
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

EJB3 & Mysql + Multiple Schema

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ranchers,

I wondered if perhaps anybody has an opinion on the following problem.

I have an EJB3 setup that services the needs of a customer. This means I have one EJB3 app deployed that connects to a MySQL database schema. However, lets imagine I have 1000 customers. Each customer will have their own MySQL schema, although structually they are identical.

A solution is to deploy the EJB3 app 1000 times and simply change the persistence.xml file to set the correct MySQL schema. However, this seems overkill and certainly not scalable.

I have done much reading around on the topic, and found articles such as:
- http://www.theserverside.com/discussions/thread.tss?thread_id=47089
- http://www.hibernate.org/429.html

In the serverside discussion, the notion of simply having one schema is raised rather than having 1000 different schemas. Obvioulsy each table would have to have some kind of client id. I can't see a problem in this, but are there considerations to be made before scrapping multiple schemas in favour of one massive schema?

Otherwise, having some code in place as discussed in the Hibernate article "Manage a separate connection (or pool of connections) for each specific database user" seems like an option.

I just wondered if anyone has any experience of dealing with this issue, what route did you take and do you have any thoughts?

Thanks in advance for any comments.

Marcus.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

but are there considerations to be made before scrapping multiple schemas in favour of one massive schema?



Yes. Both in technically and even from the perspective of a customer contract. You will certainly find many customers who don't want to "share" their data. If you maintain a single database schema for multiple customers, i am sure they would be concerned.
 
M Hathaway
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jaikiran,

Thanks for the response.

Yes this is my main concern over this approach also

In the serverside article, it sounds a no brainer......it actually changed my thinking to even consider this approach. Having not been exposed to this kind of issue, i wasn't sure if this approach was a common practice....your comments confirm my initial worries.
 
reply
    Bookmark Topic Watch Topic
  • New Topic