Hi,
<Sylvian wrote:>
Isn't it possible to have one repository.xml file but more than one
<jdbc-connection-descriptor> in it??
# No, because the repository name was a key to identify different DB in
OJB.
If you use another repository (ex.: db2_repository.xml for my second
DB), do we need the default repository for this DB?
# I do not understand your question. The default repository have to know
about the user data of your second DB.
Your second repository file should look like these:
repositoryFarAway.xml
********************************
<?xml version="1.0" encoding="UTF-8"?>
<!-- Defines the repository for a second database -->
<!-- defining entities for include-files -->
<!DOCTYPE descriptor-repository SYSTEM "repository.dtd" [
<!ENTITY farAway SYSTEM "repositoryFarAway_user.xml">
]>
<descriptor-repository version="0.9.5"
isolation-level="read-uncommitted">
<!-- The Default JDBC Connection. If a class-descriptor does not specify
its own JDBC Connection,
the Connection specified here will be used. -->
<!-- This was my second far away db -->
<jdbc-connection-descriptor
platform="Hsqldb"
jdbc-level="2.0"
driver="org.hsqldb.jdbcDriver"
protocol="jdbc"
subprotocol="hsqldb"
dbalias="../OJB_FarAway"
username="sa"
password=""
/>
#### contains your user data
<!-- user data of farAway db -->
&farAway;
</descriptor-repository>
********************************
The deault repository file
********************************
<?xml version="1.0" encoding="UTF-8"?>
<!-- This is a sample metadata repository for the ObJectBridge System.
Use this file as a template for building your own mappings-->
<!-- defining entities for include-files -->
<!DOCTYPE descriptor-repository SYSTEM "repository.dtd" [
<!ENTITY user SYSTEM "repository_user.xml">
<!ENTITY junit SYSTEM "repository_junit.xml">
<!ENTITY internal SYSTEM "repository_internal.xml">
##### reference to the user data for second database
<!ENTITY farAway SYSTEM "repositoryFarAway_user.xml">
]>
<descriptor-repository version="0.9.5"
isolation-level="read-uncommitted">
<!-- The Default JDBC Connection. If a class-descriptor does not specify
its own JDBC Connection,
the Connection specified here will be used. -->
<jdbc-connection-descriptor
platform="@DBMS_NAME@"
jdbc-level="@JDBC_LEVEL@"
driver="@DRIVER_NAME@"
protocol="@URL_PROTOCOL@"
subprotocol="@URL_SUBPROTOCOL@"
dbalias="@URL_DBALIAS@"
username="@USER_NAME@"
password="@USER_PASSWD@"
/>
<!-- include user defined mappings here -->
&user;
<!-- include mappings for JUnit tests here -->
&junit;
<!-- include ojb internal mappings here -->
&internal;
######
<!-- user data of farAway db -->
&farAway;
</descriptor-repository>
********************************
Armin
Sylvain
-----Message d'origine-----
De: Armin Waibel [mailto:[EMAIL PROTECTED]]
Date: jeudi, 12. septembre 2002 13:55
�: OJB Users List
Objet: Re: using OJB with 2 or more databases
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 12, 2002 1:42 PM
Subject: using OJB with 2 or more databases
Hello,
I plan to use OJB for my project which interacts with more than 1
database.
How could I do this with OJB??
Should I use more than one repository.xml file (one repository.xml for
each database)?
# Yes.
How do you choose the good repository.xml file? With the mothod
createPersistencebroker("repository.xml") ?
# Use createPersistenceBroker(pbKey) with a PBKey match your other DB's.
Also you can use defaultPersistenceBroker() to get PB instances of your
default repository.
What is the best solution?
# For example see
repository.xml and repositoryFarAway.xml
(some comments in the file).
See test cases
...odmg.MultiDBUsageTest
...broker.MultipleDBTest
HTH,
Armin
Thank you
Sylvain
--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>