Different connections to databases

I’m presented with a case where I must connect a single environment to different databases. The idea is that each new database created is a company, that company will be associated with a user and that user will have their respective accesses.
I have thought of creating a view where the user is configured or typed to the respective company, once logged in then he asks him which company he wants to work in and at that moment the system changes the path to the database.

I do not know if this is possible, just to think about it I have several questions that maybe you can help me solve, for example:

  1. Would it be possible to have in a database all the users and permissions, without having to replicate them in each one of the bases subsequently created?

  2. Is it possible to switch to the hot database?

  3. What do I think if it is correct ?, or would it be easier and feasible to have all the companies inside a same store and filter by the code of them once the user enters? If a good solution would perform well?

The truth is I’m open to listen to ideas and suggestions from all of you and apply the one that best suits and works with CUBA.


Please check

The sample and the good way in my opinion is make SSO aut. then create and deploy for each company a new instance of your app.

Hi Nelson,

Both implementations, with single and multiple data stores, can be achieved. The first option is easier to code and to maintain in the future. The second one is more scalable for the further use.

The implementation, as you mentioned, depends mostly on the performance side, so, there is a question how many concurrent users do you plan to have in your application?



Hi Aleksey.

The application will have 1500 concurrent users.

Then I would suggest having a single database and good hardware with clustered middleware. This topic contains valuable information on single DB SaaS approach.

Also, in the future, we are going to introduce an application component in order to simplify the way to create single DB kind of SaaS applications.



Hi Aleksey
You might have developed the app component that you mentioned to develop, if so, could you please direct me to the link, I am considering my app for Saas.