Hi Ralf, Thanks for the reply. I will have to go the Datasource route as our Pooling is a little more complex. Our component actually handles pooling for various machines within a cluster and can actually "steal" connections from one machine to give to another. It does this by acting as a cluster wide singleton connection resource manager with full failover support within the cluster.
On the last point I could however throw away my 4 JDOManagers, reset the configuration and then regenerate my 4 NEW JDOManagers using the new configuration? Thanks Again --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 2, 2006 2:55 AM To: [email protected] Subject: Re: [castor-user] Multiple JDOManager's??? Hi Mike, see my comments inline. Mike Wannamaker schrieb: > 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. Yes > > 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? Why don't you use commons-dbcp instead. It worked like a charme for me when testing it. If you like to stay with your own implementation of pooling, support of datasource interface would be the prefered way in my opinion. > > 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. As I don't know how you pluged in your component I am not able to tell you if this will still work as before. Having said that some things behind JDOManager (e.g. DatabaseRegistry) have changed at 0.9.9 release of castor. > > 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? It is always possible to load a new configuration with a different database name. It is not possible yet to unload/dispose an old configuration yet after you created a JDOManager instance even if we like to develope things in this direction. > > 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] >>------------------------------------------------- > > ------------------------------------------------- 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] -------------------------------------------------

