Accessing data using a textual query or stored procedure
If you want to retrieve data from a database using a textual SQL query or a stored procedure, create a JDBC data source.
Creating a JDBC data source
When creating a JDBC data source in BIRT Designer, you select the driver class and provide a URL to connect to the database. If the database requires user authentication, provide a user name and a password. If the database uses connection pooling, specify the path to the service. Many databases use a connection pool—a cache of database connection objects—to minimize the overhead of establishing a connection to the database. A connection pool optimizes database performance through the reuse of connections, which reduces the need to repeatedly open and close connections each time a report is run.
How to specify the connection information for a database or other JDBC data source
1 In Data Explorer, right-click Data Sources, then choose New Data Source.
2 In New Data Source, specify the following information:
1 Select JDBC Data Source from the list of data source types.
2 In Data Source Name, type a name for the data source. The name must be unique in the current report. Choose Next.
New JDBC Data Source Profile appears, as shown in Figure 5‑1.
Figure 2-15 Defining JDBC connection informationFigure 2-15 Defining JDBC connection information
Figure 5‑1 Defining JDBC connection information
3 Specify the connection information for the JDBC data source.
1 In Driver Class, choose a driver class from the drop-down list. If you do not see the driver class that you need, add the driver as described in Adding a JDBC driver.
2 In Database URL, type the URL for the database, using the format that the driver requires. For a MySQL database, for example, the format is:
jdbc:mysql://<host>:<port>/<database>
3 In User Name, type a valid user name to connect to the JDBC data source. This field can be left blank if the data source does not require a user name.
4 In Password, type a valid password to connect to the JDBC data source. This field can be left blank if the data source does not require a password.
5 In JNDI URL, type the full path to the connection pooling service, if applicable. The following path is an example:
java:comp/env/jdbc/MyDataSource
In the example, MyDataSource is the name of the JNDI database service.
4 To ensure that the connection information is correct, choose Test Connection. If Test Connection returns an error, repeat the preceding steps to correct the error. Then, test the connection again.
5 Choose Finish. The new JDBC data source appears under Data Sources in Data Explorer.