B4J Question Multi Tenant


New Member
Licensed User
I am running multiple tenants by schemas in postgresql.
How would it be with B4X to connect to the schema according to the corresponding customer.
Client_1 is for Customer_1;
Client_2 is for Customer_2;
Client_3 is for Customer_3;
Each customer has its users, restrictions, etc.
Each tenant has the same tables and structures;
but each tenant has different data

Last edited:


Licensed User
I would almost never use schema for each client and if your application grows you may have 100 or 1000 of schemas and every time you need to modify a schema you will need to do this over and over to each schema. This will be maintenance nightmare.
However to answer your question your schema has to be parameterized and very first call will have to be made to common table where you will have all tenants based on their credentials you will retrieve row for a tenant that will contain field with schema name. You will use this for all your other DB calls.

Alternatively this could be part of the application configuration and you will have to provided that to each customer to enter in their initial setup of the application.
Last edited:
Upvote 0