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:
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.
You have four ways to set up a JDBC connection:
Note: The format of the connection information should be JDBC URL/(JDBC Driver Name). For example: jdbc:odbc:jinfonet/(sun.jdbc.odbc.JdbcOdbcDriver)
.
By default, the Use ODBC Data Source checkbox is checked. It indicates that the name you input in the DSN Name field is the ODBC data source name.
Note: The JDK that JReport uses must match the ODBC data source that the operating system uses. For example, 32-bit ODBC data source can be connected by 32-bit JDK only.
Tip: After entering the JDBC URL, user name and password, you can leave the Driver text field empty and instead supply it in the property file - jdbcdrivers.properties.
Tips:
The following examples show how to set up connections via specific JDBC drivers: