The value in using the Managed Datasource capability is that the defined scripts and tasks are run automatically during the initial datasource access. This step eliminates the requirement for application code to handle tasks such as database definition, population, and migration tasks.
To use this capability of the Managed Datasource, you must define a schema and associate it with a managed datasource.
- Create the SQL script files, or create the classes (that implement the com.ibm.rcp.database.core.DatabaseTask) that operate on the database.
- Define the com.ibm.rcp.database.core.schema extension with a valid schema name and version.
- Add create, migrate, and populate definitions to the extension, referring to the scripts or classes created in step 1.
- Include a schemaReference in the target managed datasource (com.ibm.rcp.database.core.datasource) extension. If you are defining a new managed datasource, you can directly include the schema reference. If you are using the default managed datasource, you need to first define a virtual datasource on the default datasource and include the schema reference in the virtual datasource definition.
When the application code uses JNDI to look up the managed datasource, the steps associated with the schema are performed prior to the datasource being returned to the calling code.
Parent topic: Defining managed data sources: XPD622