Multitenancy in ActiveJDBC

39 views
Skip to first unread message

Jasper Adam

unread,
Dec 18, 2014, 8:58:55 AM12/18/14
to activejd...@googlegroups.com
Hi,

I was wondering if anyone has any experience with multitenancy using ActiveJDBC.

There are basically three ways of doing multi tenancy:
- Shared database, shared schema
- Shared database, seperate schema
- Seperate databases

I think using seperate databases could create maintenance problems if there is a high amount of tenants. Therefore I'm mostly interested in the first two approaches.

Does anyone have any recommendations/examples of how to implement this in ActiveJDBC?

Igor Polevoy

unread,
Dec 18, 2014, 2:57:42 PM12/18/14
to activejd...@googlegroups.com
Jasper, please take a look here:



public static void main(String[] args) {
   Base.open("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/test", "the_user", "the_password");
   Employee.findAll().dump();
   Base.close();
}


If you want different parts of execution to use connections as different database users, you can do it completely transparently to models. 
Models are not aware of how you are connected. 
This way, it becomes trivial to implement multi-tenancy 

tx
Reply all
Reply to author
Forward
0 new messages