Thanks Ralf,
With this example though I would have 4 JDOManager objects, one for each
database entry correct? Which means my objects would have to some how be
able to differentiate between JDOManager's.
Also we already have a component that does connection pooling as well as
database configuration. IE: all the information you have in the xml file
our component reads from it's own config file and creates connection pools
for each one. I was hoping to write a Datasource interface so that I could
plug it into castor, much like Jakarta pooling examples?
Example our config file looks like this:
#Mon Feb 20 00:51:26 EST 2006
mysql-database1.connect=jdbc\:mysql\://localhost\:3306/db1?autoReconnect\=tr
ue&useUnicode\=true&characterEncoding\=UTF-8
mysql-database1.class= com.mysql.jdbc.Driver
mysql-database1.user=root
mysql-database1.password=~/}>Q|1s~Y}f~>ff~IopR}yR
mysql-database2.connect=jdbc\:mysql\://localhost\:3306/db2?autoReconnect\=tr
ue&useUnicode\=true&characterEncoding\=UTF-8
mysql-database2.class= com.mysql.jdbc.Driver
mysql-database2.user=root
mysql-database2.password=~/}>Q|1s~Y}f~>ff~IopR}yR
So when I do JDOManager. createInstance("mysql-database1"); it will actually
use our component to get the database connection.
Otherwise I might have to use JDOConfFactory to do it programmatically.
Question, can you set a new configuration if say my local configuration
changed after the original JDOManager was created?
Any other suggestions? Or thoughts?
--ekiM
Aoccdrnig to rscheearch at an Elingsh uinervtisy, it deosn't mttaer in waht
oredr the ltteers in a wrod are, the olny iprmoatnt tihng is taht the frist
and lsat ltteer is at the rghit pclae. The rset can be a toatl mses and you
can sitll raed it wouthit porbelm. Tihs is bcuseae we do not raed ervey
lteter by it slef but the wrod as a wlohe.
-----Original Message-----
From: Ralf Joachim [mailto:[EMAIL PROTECTED]
Sent: March 1, 2006 12:45 PM
To: [email protected]
Subject: Re: [castor-user] Multiple JDOManager's???
Hi Mike,
it should be possible to use multiple JDOManager instances for multiple
databases. A jdo-conf may look as follows:
<?xml version="1.0" ?>
<!DOCTYPE jdo-conf
PUBLIC "-//EXOLAB/Castor JDO Configuration DTD Version 1.0//EN"
"http://castor.org/jdo-conf.dtd">
<jdo-conf>
<database name="mysql-database1" engine="mysql" >
<driver url="jdbc:mysql://localhost:3306/db1"
class-name="com.mysql.jdbc.Driver">
<param name="user" value="test" />
<param name="password" value="test" />
</driver>
<mapping href="jdo/mapping.xml" />
</database>
<database name="mysql-database2" engine="mysql" >
<driver url="jdbc:mysql://localhost:3306/db2"
class-name="com.mysql.jdbc.Driver">
<param name="user" value="test" />
<param name="password" value="test" />
</driver>
<mapping href="jdo/mapping.xml" />
</database>
<database name="oracle-database1" engine="oracle" >
<data-source
class-name="oracle.jdbc.pool.OracleConnectionCacheImpl">
<param name="URL"
value="jdbc:oracle:thin:@localhost:1521:DB1" />
<param name="user" value="test" />
<param name="password" value="secret" />
<param name="min-limit" value="5" />
<param name="max-limit" value="10" />
<param name="cache-scheme" value="1" />
</data-source>
<mapping href="jdo/mapping.xml" />
</database>
<database name="oracle-database2" engine="oracle" >
<data-source
class-name="oracle.jdbc.pool.OracleConnectionCacheImpl">
<param name="URL"
value="jdbc:oracle:thin:@localhost:1521:DB2" />
<param name="user" value="test" />
<param name="password" value="secret" />
<param name="min-limit" value="5" />
<param name="max-limit" value="10" />
<param name="cache-scheme" value="1" />
</data-source>
<mapping href="jdo/mapping.xml" />
</database>
<transaction-demarcation mode="local" />
</jdo-conf>
Creation and access to these instances is similar to using only one
database.
Having said that there is also an option to load multiple jdo-conf files
with different database definitions and differnent modes for transaction
demarcation.
Regards
Ralf
Mike Wannamaker schrieb:
> I need to be able to have multiple JDOManagers? In previous work I used
an
> AbstractDataItem that used a helper class to create/update/delete objects
> and this worked great. This was very nice, but I only had 1 JDOManager, 1
> database then. Now I have the possibility to having multiple databases
and
> multiple configurations. I'm going to create a datasource to hook into
our
> own pooling, but I'm not sure how to go about using the same kind of
> AbstractDataItem class as I won't have the luxury of a static JDO.
>
>
> For example:
>
> MySQL
> -> database1
> -> database2
> Oracle
> -> database3
> -> database4
>
>
> Any help or ideas would be helpful.
>
> --ekiM
> Aoccdrnig to rscheearch at an Elingsh uinervtisy, it deosn't mttaer in
waht
> oredr the ltteers in a wrod are, the olny iprmoatnt tihng is taht the
frist
> and lsat ltteer is at the rghit pclae. The rset can be a toatl mses and
you
> can sitll raed it wouthit porbelm. Tihs is bcuseae we do not raed ervey
> lteter by it slef but the wrod as a wlohe.
>
> -------------------------------------------------
> If you wish to unsubscribe from this list, please
> send an empty message to the following address:
>
> [EMAIL PROTECTED]
> -------------------------------------------------
--
Syscon Ingenieurbüro für
Meß- und Datentechnik GmbH
Ralf Joachim
Raiffeisenstraße 11
D-72127 Kusterdingen
Germany
Tel. +49 7071 3690 52
Mobil: +49 173 9630135
Fax +49 7071 3690 98
Email: [EMAIL PROTECTED]
Web: www.syscon-world.de
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------