RE: AW: AW: Multiple Databases within the same application
"Hagerty, Timothy CIV NAVSAFECEN, 52D" <[email protected]>
| Newsgroups | gmane.comp.java.keel.user |
|---|---|
| Message-ID | <A87876CC4C70F349B0ED74EF9F4CA776044018CA@NAEANRFKEX01VA.nadsusea.nads.navy.mil> |
Shash, Does that mean that when we have multiple connections we can no longer use: PersistentFactory pf = (PersistentFactory) request.getService (PersistentFactory.ROLE,request.getDomain()); and we must use: PersistentFactory pf = (PersistentFactory) request.getService (PersistentFactory.ROLE,id-of-default-persistent); Thanks, Tim -----Original Message----- From: user-keelframework.org-admin-rI8AND0JKYOgdSakss0wQjfEH8FBEnyy@public.gmane.org [mailto:user-keelframework.org-admin-rI8AND0JKYOgdSakss0wQjfEH8FBEnyy@public.gmane.org]On Behalf Of Shash Chatterjee Sent: Tuesday, March 23, 2004 10:38 To: user-6VIttnCrOeJXNEnpj1eHPNi2O/[email protected]; [email protected] Subject: Re: AW: AW: [Keel User] Multiple Databases within the same application Guys, A quick email since I only have a minute right now. Keel can handle multiple conmnections to multiple databases, even if they are of different types. I am using HsqlDB and Oracle concurrently. The way you do that is to define a <jdbc> elelemnt for the type/connection (i.e. this is where the JDBC driver definition and connection info go), follow the example of <jdbc id="keel-dbpool" ... > and create <jdbc id="second-dbpool">, <jdbc id="third-dbpool">. Copy the right "*-dbtype" definition for your DB from the sample-conf directory, and change the id="keel-dbtype" to "oracle-dbtype" for instance. Then define a <default-persistent id="second-db" ....> <default-persistent id="third-db" .....>. Each default-persistent should have a nested <dbpool ...> element to pick from the <jdbc > definitions above, and a <dbtype ...> element to tell Keel what type of DB (SQL syntax variations) it is. Then you lookup: PersistentFactory pf = (PersistentFactory)req.getService(PersistentFactory.ROLE, id-of-default-persistent); HTH, Shash PS: Here's an example for Oracle. <jdbc id="sfpman-dbpool" activation="request"> <pool-controller max="10" maxStrict="true" blocking="true" timeout="-1" trim-interval="60000" auto-commit="true" connection-class="org.apache.avalon.excalibur.datasource.JdbcConnection" > <keep-alive disable="false">select 1</keep-alive> </pool-controller> <driver>oracle.jdbc.driver.OracleDriver</driver> <!-- example: <dburl>jdbc:oracle:thin:@localhost:1521:KEEL</dburl> --> <dburl>jdbc:oracle:thin:@ora-dev-db1:1522:OATST</dburl> <!-- example: <user>Scott</user> --> <user>WRNSFP</user> <!-- example: <password>tiger</password> --> <password>WRNSFP</password> </jdbc> <default-persistent id="sfpman" name="default" security="default" logger="persist-default"> <dbpool>sfpman-dbpool</dbpool> <dbtype>oracle-dbtype</dbtype> > You can use it as a load balancer, but it's also possible to > "partition" your database... that means you can put some tables on > one database and some on others... they call this RAIDb (Redundant > Array of Inexpensive Databases). > > Look in the features section of this > (http://www.objectweb.org/wws/d_read/marketing/public/projects/C- > JDBC.pdf) document... > > -----Ursprüngliche Nachricht----- > Von: [email protected] [mailto:[email protected]] > Gesendet: Dienstag, 23. März 2004 16:15 > An: user-6VIttnCrOeJXNEnpj1eHPNi2O/[email protected] > Betreff: Re: AW: [Keel User] Multiple Databases within the same application > > I'm not sure that c-jdbc does what you're wanting. Isn't it more of > a load-balancer? > > It's a pretty neat piece of software though! > > Please respond to user-6VIttnCrOeJXNEnpj1eHPNi2O/[email protected] > Sent by: user-keelframework.org-admin-rI8AND0JKYOgdSakss0wQjfEH8FBEnyy@public.gmane.org > To: <user-6VIttnCrOeJXNEnpj1eHPNi2O/[email protected]> > cc: > > Subject: AW: [Keel User] Multiple Databases within the same > application > > Salut, > > I'm also interested in this scenario and it could be done with keel. > > Though, another solution would be to use c-jdbc by objectweb. It's a > jdbc driver that hides multiple databases behind a single (virtual) database. > > Pro: > - it's only jdbc... > > Con: > - I think with the persistence service you can only handle ONE > database TYPE, i. e. several Oracle instances, but no mix of > different database products... BUT: might be possible with a > "generic sql" configuration. > > I'm going to explore this in the next days... maybe I'll be able to > say more about it... > > Aleks > > -----Ursprüngliche Nachricht----- > Von: Hagerty, Timothy CIV NAVSAFECEN, 52D [mailto:[email protected]] > Gesendet: Dienstag, 23. März 2004 15:52 > An: user-keelframework.org-rI8AND0JKYOgdSakss0wQjfEH8FBEnyy@public.gmane.org > Betreff: [Keel User] Multiple Databases within the same application > > Hello All, > I have a question about multiple database connections. > I have 3 separate database connections going to 3 different > databases. When I use the following code: PersistentFactory pf = > (PersistentFactory) request.getService(PersistentFactory.ROLE, > request.getDomain()); I > get a connection to the first jdbc connection listed within the > merged.config file. How do I set one of those connections apart from > the other 2 as the default connection when I use the code: > request.getDomain()? Thanks, Tim _______________________________________________ > User mailing list > [email protected] > http://lists.keelframework.org/listinfo.cgi/user-keelframework.org > _______________________________________________ > User mailing list > [email protected] > http://lists.keelframework.org/listinfo.cgi/user-keelframework.org _______________________________________________ User mailing list [email protected] http://lists.keelframework.org/listinfo.cgi/user-keelframework.org