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-13 13:14 GMT+02:00 Alex Soto <[email protected]>: > Hi I am still working on this feature but I can't find a test nor a Javadoc > that explains each parameter. Let me paste here: > > public static CommonDataSource create(final String name, > final boolean configuredManaged, > final Class impl, > final String definition, > final Duration maxWaitTime, > final Duration > timeBetweenEvictionRuns, > final Duration minEvictableIdleTime) > > > Name: is the name of the datasource > right, not that useful excepted for JMX and serialization on tomee 7 (weird to write it for the first time) > ConfiguredManaged: I don't know what implies true or false > JtaManaged > Impl: I don't know what does this means: means adding > JDBC Driver or DataSource class (@DataSourceDefinition) > SimpleDataSourceCreator, or DbcpDataSourceCreator, ... What is the best? > The one fitting your need. dbcp is the historical one, tomcat-jdbc our default since several versions. Don't provide it and it should be fine. > Definition: I think this is the string that you typically put inside > Resource tag. > Yes, basically all properties of your pool. > Durations: I understand the meaning what are the default values in TomEE? > There are taken from https://git-wip-us.apache.org/repos/asf?p=tomee.git;a=blob;f=container/openejb-core/src/main/resources/META-INF/org.apache.openejb/service-jar.xml;h=b415e6a954e247b369b445b652ecc078d61088bc;hb=3d9c644fe8150bb6d345f7e8548f6c24a4aef65e Side note: if you read Default "JDBC Database resource" you get this mapping: constructor="ServiceId, JtaManaged, JdbcDriver, Definition, MaxWaitTime, TimeBetweenEvictionRuns, MinEvictableIdleTime" > Thank you so much. > Alex. > > > > El dt., 12 maig 2015 a les 16:24, Romain Manni-Bucau (< > [email protected]>) > va escriure: > > > in definition: PropertiesHelper.propertiesToString(props) > > > > > > 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 16:18 GMT+02:00 Alex Soto <[email protected]>: > > > > > Hi yo umention to use DataSourceFactory. I have seen this method > > > > > > > > > https://github.com/apache/tomee/blob/98029f7374edea604347e1c0a5f598fb793a65e6/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/DataSourceFactory.java#L85 > > > but how I can set Properties like username, password, ... > > > > > > El dt., 12 maig 2015 a les 11:35, Alex Soto (<[email protected]>) va > > > escriure: > > > > > > > Cool thank you so much. I am going to work in this direction :). > > > > > > > > El dt., 12 maig 2015 a les 11:33, Romain Manni-Bucau (< > > > > [email protected]>) va escriure: > > > > > > > > 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. > > > >> > > > > >> > > > > > > > > > >
