Hi, > Hi everyone. > > We are developing a web application that has one global database and > multiple "client" databases with the same schema (around 70 > tables in around > 40 databases so far). Every user who logs in should be > assigned a specific > client database. > > Today we are using a proprietary solution where I have wrapped the > connection pool of the J2EE server (Resin) and then before calling the > database switch to the correct client database dynamically > using MySQLs > "USING datbase" command. > > I have thought many times about how nice it would be to use > CMP EJBs or some > other standardized/third party API, to save us time with the > O/R mapping. > But it always comes down to our parallell databases. I have > understood you > could create a solution with BMP EJBs, but that seems quite > meaningless, > since our proprietary solution is working today. > > I tried out OJB in a small hobby project and I liked it a > lot. And so, today > when I thought of a way to incorporate OJB in our system I > had an idea I > would like to hear your thoughts on. > > What if we had different repository.xml files for every > client database. The > only differense in the repository.xml files > repository1.xml: > <jdbc-connection-descriptor > ... > dbalias="//host.net/clientdatabase1" > ... > /> > > repository2.xml: > <jdbc-connection-descriptor > ... > dbalias="//host.net/clientdatabase2" > ... > /> > > Then we would instantiate a PersistenceBroker for every > client database in > use (maybe store the PersistenceBroker in the session?), and > use that broker > everytime we acess the database. > > - Does anyone see anything wrong with this?
NO. Using different repositories with different JDBC connection descriptors is the OJB way of connecting to multiple DBs! > - Does anyone see any other solution? Like creating a proprietary > PersistenceBrokerFactoryClass or ConnectionFactoryClass? WOuld be a lot of work... > - What about transactions? (Multiple users could be logged > into the same > client database) No problem. All broker calls using the same DB use properly synchronized JDBC transactions. > > One thing I'm particularily wondering about is what would happen if we > decided to run OJB in client/server mode? Multi DB support for C/S mode is in CVS already, but not in release 0.9.7 ! I hope to fix all current C/S mode issues for the next release. cheers, Thomas > Any comments will be highly appreciated. > > Mattias Jiderhamn > Expert Systems > > [EMAIL PROTECTED] > http://www.expertsystem.se > > > -- > To unsubscribe, e-mail: > <mailto:ojb-user-unsubscribe@;jakarta.apache.org> > For additional commands, e-mail: > <mailto:ojb-user-help@;jakarta.apache.org> > > -- To unsubscribe, e-mail: <mailto:ojb-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>
