Setting Up a JDBC Data Source for Reporting
MyEclipse Reports is designed to share JDBC drivers configured for use with database tools. A special data source, the MyEclipse JDBC data source, allows the reporting tools access to these drivers. This tutorial shows you how to set up the MyEclipse JDBC data source. You will learn how to:
- Create and edit a data source
- Manually sync a data source
Duration Time: 10 Minutes
Don't have MyEclipse? Download Now
- Open the Report Design perspective by selecting Windows>Open Perspective>MyEclipse Report Design.
- Launch the Report Designer by either creating a report or opening an existing report.
- In the Data Explorer, right-click Data Sources, and select New Data Source.
If this view is not visible, select Window>Show View>Other, expand MyEclipse Report Design, and select Data Explorer.
- Select the MyEclipse JDBC Data Source, type MyEclipse Derby DS in Data Source Name field, and click Next.
- Select MyEclipse Derby from the Driver drop-down, and click Finish.
If you want to create a new MyEclipse JDBC driver, click the Create new driver link. You can also edit existing drivers using the Edit driver link.
Note: To provide seamless MyEclipse Reports integration, only drivers with saved passwords can be selected. To learn more about MyEclipse drivers, please see Connecting to a Database in MyEclipse.
- Enter a descriptive name in the Data Source general properties.
The new MyEclipse Derby DS data source appears in the Data Explorer view.
During the process of creating the new MyEclipse JDBC data source, the Database Explorer JDBC driver properties, namely, connection URL, driver class name, username and password, are copied into the report file. Additionally, the Database Explorer JDBC driver's JAR files are copied into the folder, <projectName>/WebRoot/Web-INF/report-engine/platform/plugins/org.eclipse.birt.report.data.oda.jdbc_<version>/drivers. These JAR files are deployed along with your report's web project.
During the life-cycle of a MyEclipse JDBC data source, you might need to rename the data source or change the associated MyEclipse JDBC driver bound to the data source.
2.1 Renaming a Data Source
To rename a data source, right-click the data source in the Data Explorer, and select Rename. The name you use must be unique to the current report.
2.2 Changing the Database Explorer JDBC Driver Bound to a Data Source
- In the Data Explorer, expand Data Sources, right-click the data source you want to modify, and select Edit.
- Select a new MyEclipse driver from the Driver drop-down, and click OK to commit these changes to your report.
If you change the associated MyEclipse driver, driver JAR(s) from the new driver are copied into your project.
Because the MyEclipse JDBC data source is coupled with a MyEclipse JDBC driver, the data source's JDBC properties cannot be directly edited in the data source. To change these properties, you must edit them in the associated Database Explorer driver.
3. Manually Sync'ing the JDBC Data Source
A stale JDBC Data Source situation can persist after the automatic synchronization described in Reporting Tools in MyEclipse. There are several reasons this can happen. For example, the data source validator can not detect stale data sources in a project that is closed; therefore these resources are not available in the Synchronization window. In such cases, it is possible to manually synchronize the JDBC data source.
- In the Data Explorer, right-click the stale JDBC data source, and select Edit.
- In the left column, select MyEclipse JDBC Data Source, and click Synchronize Driver.