Setting up a JDBC connection

This procedure assumes you have set up the JDBC driver as described in the previous task.

Note: The URL format is regulated by the driver itself. That is, different drivers have different URL formats. The format of the driver template in JReport Designer jdbcdrivers.properties is jdbc.drivers=JDBCDriverName:JDBCDriverName:...

where, JDBCDriverName is the JDBC driver name that can be auto-loaded when JReport starts up and ":" is the delimiter between two driver names. JReport will search from the first and find one that can work with the driver, URL, and user name and password in the catalog.

Below is an example of the jdbcdrivers.properties file which specifies an Oracle thin driver and an Interbase thin driver:

jdbc.drivers=oracle.jdbc.driver.OracleDriver:interbase.interclient.Driver

To set up a JDBC connection:

  1. Create a catalog or open a catalog, then in the Data tab of the Catalog Browser, right-click the node of a data source and choose Add JDBC Connection from the shortcut menu.

    If you want to set up the connection by adding a data source to an existing catalog and then defining the connection on the data source, open the catalog, select any data source contained in it, click the New Data Source button on the Catalog Browser toolbar, then in the New Data source dialog, specify the name of the data source, select the JDBC connection type and click OK.

  2. In the Get JDBC Connection Information dialog, specify the options as required. See the dialog.
  3. Click OK to set up the connection, and you will be prompted with a message box showing the status of connecting to the JDBC driver. Then you can add tables stored in the database to the catalog in the displayed Add Table dialog.

You have four ways to set up a JDBC connection:

Tips:

The following examples show how to set up connections via specific JDBC drivers: