"How can I build a single web application that uses different database connections at runtime?"
As part of building a portal solution, a user writes in to ask how different view objects can query data from different database connections at runtime. The answer is, "use a different application module for each connection", and he should be in business. In one project he can create two different application modules. In each application module's configuration, he can setup the desired database connection. By adding instances of view objects to the appropriate application module component, at runtime when each of these application modules is used, each will get its database connection as setup in its configuration.
If the view object queries a database schema object that exists in both databases, you could even use the same underlying view object definition in both application modules. Adding one instance of this VO to AM1 and another instance of it to AM2, at runtime it will execute in the context provided to it by the containing application module component.
At design time, if you need to change your project-level connection for design time use, you can right-mouse on the JPX file and edit its settings to change the connection.
11:10:03 AM
|