Using alternative data sources

 

Several Actions, namely SQLSelect, SQLUpdate, SQLDisplay, DynamicDropDown and CascadingMenus can operate with data in a different database.

Normally, ViewsFlash database operations use a single database schema referred to using a JNDI data source, defined by ViewsFlash servlet parameters, especially database and databasename.
These operations allow referring to other datasources that can refer to different schemas in the same database, to other databases, and even to tables in different brands of database (eg Oracle / DB2 ).

The Actions mentioned here accept an additional parameter:
datasource=JNDIDataSourcename

The SQL statements used by those queries will be executed against the database specified by this alternate JNDI data source.
There is no need to specify the brand of database (Oracle, etc). The SQL statements need to conform to the syntax of the particular database, of course.
All of the database configuration parameters, such as user ID, password, schema, etc., have to be specified in the data source.

Note that all these Actions accept the [/dbtablenameprefix] syntax in the query. For example,
select * from [/dbtablenameprefix]tablename where x=1
will replace [/dbtablenameprefix] with the value used for that servlet parameter if one is present.

Note that the exact syntax of the datasource parameter depends on the application server being used.
For most application servers, it is just the name of the JNDI data source:
datasource=NameOfTheJNDIDataSource
Tomcat, however, requires:
datasource=java:comp/env/NameOfTheJNDIDataSource

Next: Application Security