views:

117

answers:

3

Hello!

I want to develop SaaS application, that will be used in small companies. Technologies are: Java, Spring, Struts2. I want to host it on my server.

What is the better: develop make one copy and one database for one company, or develop the application that can be used for all in one time and use 1 database?

+2  A: 

It's probably a trade off between the ease of maintenance vs. what the customers want. Putting all the data in a single database may make it easier to roll out fixes and update the schema, but your customers might not like the fact that their data is mixed in with other customers' data, and you may end up with more of a single point of failure for all customers.

Doing separate databases will give you isolation between customers, but will require you to roll out fixes to every database if the need comes up.

You could consider supporting both options, in a similar model to web hosting. You could offer a "shared" environment where, you put multiple customers on the same database for a little less money, and also offer a "dedicated" option, where you isolate customers for a little more money.

Andy White
+1  A: 

This is the issue of Multitenancy.

There's no one correct answer. It really depends on the specific requirements.

If you have one DB per company, you may find that the administrative overhead is large to create, backup, and maintain all of the copies of the database. However, you can be very confident that your code will not accidentally expose one customer's data to another customer (which is hugely important).

If you have one DB to hold multiple clients, you will find that the DB administration is much easier. However, you need to pay a great deal of attention to logically separating your customer's data and ensuring that every single query acts only on the right data.

Eric J.
A: 

Do you want to sell software solutions or be an Application Service Provider (ASP)? The type of data you want to store may affect your answer. Look out for any regulatory issues if the data happens to be related to privacy (personal info, health info, credit card numbers) etc.