Switching the Data Source of a Domain
You can select a different data source for a Domain on the Edit Domain page or in the Manage Data Source dialog box. However, because the Domain design relies extensively on the data source, it is likely that some tables in your Domain won’t be valid and information such as derived tables and calculated fields will be lost. Always back up a Domain before switching the data source, and make sure that the change makes sense for this Domain and data source. Examples where it may make sense to switch the data source include:
| • | Switching to a data source with a different database schema but with the same tables; for example, when moving from staging to production. |
| • | Switching from a regular data source to a virtual data source that contains the original data source. In this case, JasperReports Server attempts to locate the original data source inside the virtual data source and create the correct prefix. Derived tables and calculated fields are not preserved. |
| • | Switching from a virtual data source to one of the data sources it includes. In this case, any resources that are not in the selected data source are deleted along with any dependent information, such as joins or labels that depend on the deleted resources. Derived tables and calculated fields are not preserved. |
![warning-icon-ns_28x28.png.eee54059a0ad1a325292d149e6588a2f.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) | If you change to a data source with a different schema structure, the definitions in the Domain design are no longer valid and you cannot save the Domain. |
To change the data source of a Domain:
| 1. | Log in to the server as an administrator and select View > Search Results. |
| a. | Choose View > Search Results. |
| b. | In the Filters panel, under Types, click More choices. |
| 4. | Locate the Domain again, right-click it and select Edit from the context menu. |
The Edit Domain page appears.
![js-EditDomain-DataAndDesign_511x467.png.2eec2063f9b51fe04f4056ea5a9d5112.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) |
Edit Domain Page |
| 6. | In the Name field, change the display name of the Domain. |
| 7. | In the Description field, change the description of the Domain. |
| 8. | In the Data Source field, browse to locate a new data source for the Domain. |
| 9. | Click Edit with Domain Designer. If you are working with a virtual data source and the database schema used by the original Domain is not available in the data source, you are asked if you want to select a schema. Select Yes to select one or more schemas and click OK; the first schema you select is added to the name of the tables in the Domain. Select No to remove all schema prefixes from the tables in the Domain. |
| 10. | Click Submit to update the Domain. To close the Domain Designer without modifying the Domain stored in the repository, click Cancel. |
As mentioned above, in some cases, derived tables and calculated fields will be missing. You may also see invalid tables. You can work with the copy of your original Domain and its exported design file to determine the modifications you need to make to fully restore your domain. For more information, you can export the design file of the modified Domain, as described in Exporting the Design File from a Domain, and compare it to the design file of the original Domain.
Recommended Comments
There are no comments to display.