Hi Alex

a dynamic router is surely the way to go, ie one datasource fully handled
by tomee and other ones handled by you. You can of course reuse tomee
DataSourceFactory to help to make it smooth and reuse our configuration but
you'll have to instantiate them (ie call the create method yourself) and
destroy them as well.

There are ways to add them in the container with few code but you wouldn't
get any benefit from it and you would surely get potentially few drawbacks
if you share your container instance with other apps.

Hope it helps



Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-05-12 11:20 GMT+02:00 Alex Soto <[email protected]>:

> Hi guys,
>
> I have one question. Currently I am developing a multitenant application
> which each tenant has its own database schema. The schema in fact is a
> Oracle DB schema.
>
> So each tenant may need its own DataSource because each tenant will have
> its own login and password.
>
> The problem is that we need to add dynamically new tenants which implies
> defining new datasources on demand. Is this possible in TomEE? I am
> thinking in doing using a DynamicRouter to dynamically choose which
> DataSource to use depending on the tenant that it is making the request,.
>
> Thank you so much.
> Alex.
>

Reply via email to