Hello!
I am designing a saas app that is going to be made with b4j and abmaterial.
What I am currently spending my time thinking about is the database architecture.
currently in my testing I am using one sigle database with a user_auth table to authenticate users against, and a single database for all the users where
each user is separated by a tenant_id field in the tables.
As my application really should have more data separation than that, I would like to have separate databases for each client/user.
Now, I have tested somtehing like this, where I use a single database connection, authenticated by a user that has acces to a user_auth database and all the
user databases.
When a user is logged in, the session stores the name of the database, and I am using this databasename to separate the users in every SQL queary I use against the database server.
My question is: Is this a good enough aproach when I want to separate the data?
Or should I use two db connections:
Connection 1:
This will be used to connect directly to the auth database with a database user who has access to only the auth database.
Connection 2:
This uses the info gathered from connection 1 to establish a connection directly to the users database.
I hope this question makes sense :O
/ronny
I am designing a saas app that is going to be made with b4j and abmaterial.
What I am currently spending my time thinking about is the database architecture.
currently in my testing I am using one sigle database with a user_auth table to authenticate users against, and a single database for all the users where
each user is separated by a tenant_id field in the tables.
As my application really should have more data separation than that, I would like to have separate databases for each client/user.
Now, I have tested somtehing like this, where I use a single database connection, authenticated by a user that has acces to a user_auth database and all the
user databases.
When a user is logged in, the session stores the name of the database, and I am using this databasename to separate the users in every SQL queary I use against the database server.
My question is: Is this a good enough aproach when I want to separate the data?
Or should I use two db connections:
Connection 1:
This will be used to connect directly to the auth database with a database user who has access to only the auth database.
Connection 2:
This uses the info gathered from connection 1 to establish a connection directly to the users database.
I hope this question makes sense :O
/ronny