|
||
Table of Contents |
||
1. IntroductionThe data used to create MyEclipse reports can be retrieved from a number of physical sources such as relational databases, web-services, XML files or even flat files. To minimize the complexity that would result if the MyEclipse report engine and report designer were required to understand and implement the interface for interacting with all of these very different data providers, MyEclipse Reports uses a programmatic abstraction known as a "data source". A data source insulates the MyEclipse report engine and report design tools from the implementation details of connecting with the physical provider of data for a report. In this tutorial we will introduce the basic concepts and tools for working with a special type of data source known as the MyEclipse JDBC data source. For an overview of the MyEclipse Reports tools and development features, see the MyEclipse Reports Overview document. Suggested Audience
This tutorial assumes the reader is familiar with the
MyEclipse
Database Explorer features. To get a better feel for the full scope of MyEclipse,
please check out our product
documentation.
System Requirements
This tutorial was created using MyEclipse 6.0.1 Professional
Edition. If you are using a more recent version of MyEclipse,
most of the images and instructions should be backward
compatible.
|
||
2. MyEclipse JDBC Data Source Basics
The MyEclipse Database Explorer consists of a rich set of relational
database browsing and development tools. The Database Explorer
interacts with relational database systems using the respective
JDBC drivers for each specific relational database, e.g. Oracle,
MS SQL Server, MySQL, DB2, etc. MyEclipse Reports is designed to allow use of the
Database Explorer's configured JDBC drivers using a special data
source known as a MyEclipse JDBC Data Source.
The MyEclipse JDBC Data Source is extremely convenient in that it allows you to reuse existing Database Explorer JDBC drivers and avoid repeating a very similar database driver configuration process in MyEclipse Report that you have already performed in the MyEclipse Database Explorer. It doesn't take much experience working with databases to understand that correctly setting up a JDBC driver can be an error prone process. Thus, by reusing working Database Explorer drivers as data sources in MyEclipse Reports you are assured of a hassle-free driver setup experience when creating a MyEclipse report. A MyEclipse JDBC Data Source can
be used by multiple reports. If you do plan to reuse a data
source in multiple report projects, you can create that data
source in a library and reuse that data source from the library.
The advantage of this approach is that updates to the MyEclipse
JDBC data source in the library are subsequently available to all
reports that use the library through a sophisticated report-data
source synchronization process.
When you create a report design, you use the data explorer, as shown in Figure 3-1, to create and manage data sources. The MyEclipse Report Designer supports using as many data sources as necessary for the report design. The data sources can be of different types, however, MyEclipse supports the use of the MyEclipse JDBC data source which is closely coupled with a corresponding MyEclipse JDBC driver. |
||
3. Creating a MyEclipse JDBC Data Source
The newly created MyEclipse Derby DS data source should be present in the Data Explorer View.
During the process of creaing the new MyEclipse JDBC data source, the Database Explorer JDBC driver properties (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 will be deployable along with your report's web
project.
|
||
4. Editing a MyEclipse JDBC Data Source
During the life-cycle of a MyEclipse JDBC data source you may
have a need to rename the data source or change the associated
MyEclipse JDBC driver bound to the data source.
4.1 Renaming a Data Source
To rename a data source, right-click the data source in the data
explorer and choose Rename from the context menu. The name that
you use must be unique to this report.
4.2 Changing the Database Explorer JDBC driver bound to a Data SourceTo change the associated MyEclipse driver:
If you change the associated MyEclipse driver, driver JAR(s) from this new driver will be copied into your project. Because the MyEclipse JDBC data source is coupled to 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. |
||
5. MyEclipse JDBC Data Source Validation and SynchronizationWhen you modify a Database Explorer JDBC driver that is bound to a MyEclipse JDBC data source its new state is different from that maintained by the MyEclipse JDBC data source. This state results in a stale JDBC data source and can result in unexpected report results. MyEclipse Reports provides a JDBC data source validation and synchronization tools to detect stale JDBC data sources and resynchronize them with their Database Explorer JDBC drivers. 5.1 JDBC Data Source Synchronization
5.2 Problems View and Warning Markers
During the validation process MyEclipse JDBC data sources are
compared with the state of their corresponding Database Explorer
JDBC drivers. If there is a mismatch between any of the JDBC
properties or the driver JAR files, the report is marked with a
Warning icon. This warning can be seen in the Problems view. The
report will also be marked with a warning if it references an
unsynchronized data source in a library.
5.3 Manual JDBC Data Source ResynchronizationA stale JDBC Data Source situation can persist after the synchronization opportunity described in Section 5.1. There are several reasons that this can happen. For example, the data source validator can not detect stale data sources in a project that is closed and hence these resources will not be available in the Synchronization dialog view. In such cases it is possible to manually synchronize the JDBC data source.
Note-1a: Since your report's data source is
connected to a MyEclipse JDBC driver, when you preview the
results in the Report Designer Preview page, the JDBC properties
from the associated Database Explorer JDBC driver will be used to
establish the database connection, irrespective of the JDBC
properties that may be stored in your report file. At runtime,
the JDBC properties in your report will be used.
|
||
6. FeedbackWe would like to hear from you! If you liked this tutorial, has some suggestions or even some corrections for us please let us know. We track all user feedback about our learning material in our Documentation Forum. Please be sure to let us know which piece of MyEclipse material you are commenting on so we can quickly pinpoint any issues that arise. |