mrc Documentation
michaels, ross & cole, ltd.
http://www.mrc-productivity.com/
|
|
Web
2.0 Variable Data Source
The data source is the definition of the database connection which includes:
Multiple data sources can be defined in the global Data Source Configuration file (/mrcjava/WEB-INF/classes/mrc-spring-context.xml.) In each dictionary (/mrcjava/WEB-INF/classes/DD/mrc_servlet_config.xml), you can assign a single data source for all applications within that dictionary with the datasource parameter.) You can override that default data source selection at the program level by specifying another data source in the application properties file (/mrcjava/WEB-INF/classes/DD/IXXXXXp.xml.)
Sometimes, though, as the application designer, you might prefer to set the data source conditionally. An example of that would be a case where you would like to allow the end user to select a company to work in. So you can present the user with several companies they may work in. Behind the scenes, the user’s company selection will set the data source for the current browser session. The differences in the data source might be minor, different only because of the library list definition, or major, with different IP and DB types. Subsequent applications, then, will use the selected data source instead of a pre-defined one for the current browser session.

In the example above, you can see that despite the thousands
of records, the user
Here are the steps to complete this process:
i. SetDataInSession?data_src=as400_remote_CO1&redirect_url=DD.I00100s
i. <a href="SetDataInSession?data_src=as400_remote_LIB10&redirect_url=DD.I00100s">Company 10</a>
End User Screen Flow:
mrcSignon (end user authentication, optional)
Data Source Selection (DD.I00010s, for example)
DD.I00100s (application or menu of applications)
If the data source definitions will only be different due to the library list setup, then it will be necessary to configure the applications to avoid hard-coding the data library name in the SQL statement. That is done by setting the tablename_fmt parameter to “1” (Table name only) in the Data Dictionary properties file: mrc_servlet_config.xml. This will instruct the applications to use only the table name in the SQL, not the data library name which was used at development time, allowing the library list to determine which data library to use. If you have any individual applications that should use their data library name in the SQL statement, you can add that parameter at the program level and set it appropriately there.