dear ojb user list,
i was asked to describe my thoughts about dynamic database connections and schemas.
See below,
chris tava
let's suppose you are tasked with writing data to multiple databases accounts with the
same schema. let's call the schema, the v1.0.0 schema.
when i use the word schema i am refering to the physcial model - relational database
model. obviously, using the OJB tool you can create an object.attribute to relational
table.column map (O-R map). and you can use the PBKey class to make a connection to
any account using a specific O-R map.
PBKey pbKey = new PBKey("v1.0.0",getAccountName(), getAccountPass());
PersistenceBroker pBroker = pBrokerFactory.createPersistenceBroker(pbKey);
now, let's suppose the next version of the system comes out and you have a new
database schema, let's call the v2.0.0 schema. and let's suppose only a few of the
database accounts are updated at a given time.
therefore, if you have some key identifier in your system that determines which
version of the schema at particular database account is using, then you can use this
information to make a connection to the specific database accounts using specific
schemas.
if (schemaVersion.equals("v1.0.0") {
PBKey pbKey = new PBKey("v1.0.0",
getAccountName(),getAccountPass());
}
else if (schemaVersion.equals("v2.0.0") {
PBKey pbKey = new PBKey("v2.0.0",
getAccountName(),getAccountPass());
}
---------------------------------
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search