Hello,

We have a Software as a Service (SaaS), multi-tenant hosting platform where we 
assign tenants to different database servers.  We have been handling this so 
far by getting database connections through code where we get the connection to 
the right database server for the current user based on which tenant he is with.

We are switching to a design where we no longer control the obtaining of the 
database connection since the connection is being obtained automatically based 
on configuration of datasource and persistence (persistence-unit).  But we 
still need some way to support the selection of correct database server based 
on the tenant.  We do NOT want to deploy an enterprise app multiple times (once 
for each tenant with a different datasource configuration).  A couple of ideas 
we have are:
1) when looking up the datasource in jndi using jndi-name (e.g. 
jdbc/myDatasource), return a different datasource based on the user context.  I 
don't know how feasible this is without maybe writing our own jndi service.
2) using AOP features, intercept the code obtaining the database connection and 
return the connection to the correct database server rather than the one that 
is configured.  Again, I don't know how feasible this is.

If you have any suggestions on a different approach or any suggestions on one 
of the two approaches (or even the infeasibility of them), please let me know.

Regards,
Len Takeuchi

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4082801#4082801

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4082801
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to