Hi Andrus,
yes, you are correct. There is only one database connection per
application environment. I think I can already work with your second
solution. Will try that and let you know.
Thanks for your help.
Gruß/Regards,
Tobias.
*Adternity GmbH*
Kennedydamm 1
40476 Düsseldorf
Tonhallenstraße 16
47051 Duisburg
Tel.: +49 203 298685 37
eMail: [email protected]
Web: http://www.adternity.net
Geschäftsführer: Thomas Servatius, Jörn Mika, Tobias Wolff
Amtsgericht: Düsseldorf, HRB 60031
Steuer-Nr.: DE238773677
On 4/24/12 9:13 AM, Andrus Adamchik wrote:
Hi Tobias,
If I understand you correctly, at any moment in time each application would
only access a single database. Those databases are different from environment
to environment, but still it is always 1 database per application. In this case
I wouldn't bother with multiple DataNodes. Those exist for a different purpose.
Rather figure out a way to configure appropriate database connection *outside
*Cayenne. There are a few ways of doing that:
1. By using JNDI (so the DataSource configuration, such as DB URL and login are
stored in the web container)
2. In Cayenne 3.1 it is possible to setup DataSource properties via Java
startup parameters, so in each environment you would use parameters specific to
the desired DB. E.g.:
-Dcayenne.jdbc.driver=com.mysql.jdbc.Driver
-Dcayenne.jdbc.url=jdbc:mysql://localhost/db?useUnicode=true&characterEncoding=UTF-8
-Dcayenne.jdbc.username=xyz
-Dcayenne.jdbc.password=123
I am actually using the combination of the 1& 2 - map the DataNode to use
JNDI. Configure JNDI in QA and production, but use properties like above when
developing locally in Eclipse in the absence of JNDI.
Andrus
On Apr 23, 2012, at 7:14 PM, Tobias Wolff wrote:
Hi,
we are working with Cayenne in a small team. Each of the team members has its
own local environment as well as we do have a staging and a production server -
again having it's own environments. Ideally, I would want to have only one
DataDomain with one DataMap and multiple DataNodes of which I can select the
right one at run time. Is this doable?
Currently, multiple Cayenne configurations each having one DataDomain with one
DataMap and one DataNode which is quite unfortable to handle.
Gruß/Regards,
Tobias.
*Adternity GmbH*
Kennedydamm 1
40476 Düsseldorf
Tonhallenstraße 16
47051 Duisburg
Tel.: +49 203 298685 37
eMail: [email protected]
Web: http://www.adternity.net
Geschäftsführer: Thomas Servatius, Jörn Mika, Tobias Wolff
Amtsgericht: Düsseldorf, HRB 60031
Steuer-Nr.: DE238773677