aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes muliple db's accessed by 1 application server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "muliple db Watch "muliple db New topic
Author

muliple db's accessed by 1 application server

chester smith
Greenhorn

Joined: May 24, 2005
Posts: 2
Hi,
We've developed our own application session server functionality, (with our own proprietry data access layer) to process user requests; and based on their user details, direct the request to that users appropriate database to either retrieve or update data. We've hundreds of clients, therefore hundreds of databases, 1 per customer (MS SQL Server). All requests are driven by the 1 application server - which comprises the web server (JRUN) and a session server - our own implementation.

We're now about to start evaluating other application servers on the market. eg. JBoss etc, with a view to use CMP or Hibernate. My problem is how could we configure or manage multiple databases with these application servers. For example, would JBoss know how to differentiate between a 'client' object with a primary key of '1' from one database and the same 'client' object type from a different database with a primary key of '1'? How would any application server handle this?

The option to incorporate all databases into one 'mother of all databases' is not an option.

Any help or ideas would be greatly appreciated.
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
I know with hibernate you could have several configurations, either in a file or in code, and have any number of configurations loaded at any one time. Assuming you go the file route you would basically need a file per DB, although I imagine you could automate the configuration file generation.

I'm guessing the tables in each database are the same so the only difference would be the db/alias name.

A possibly easier option might be to have the configuration in code, but pass in a parameter for the db name when you build it. That would eliminate the duplicate configurations. Then you would lose the ability to change configuration without a new build (it could be done, but would be harder), but that doesn't sound like it would be a problem.
chester smith
Greenhorn

Joined: May 24, 2005
Posts: 2
Thanks for getting back to me.

Anybody have any further idea's especially related to CMP. How does the Application server differientiate between the same object type from one DB and the same object from another DB - where both objects share the same primary key value.

Thanks in advance.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


How does the Application server differientiate between the same object type from one DB and the same object from another DB - where both objects share the same primary key value.

JBoss won't do this, and I very much doubt that any application server will. You'll have to handle it yourself.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: muliple db's accessed by 1 application server