Working With JDBC Drivers
This section describes how to set up your installation to use a driver other than the default driver.
Open Source JDBC Drivers
For open source JDBC drivers, buildomatic is set up to use a single default driver. If you want to use a driver other than the default driver, you can modify the buildomatic property files that determine the default JDBC driver.
The buildomatic JDBC driver property files are set up to point to a specific driver jar. This allows for multiple driver jar files in the same buildomatic/conf_source/db/<dbType>/jdbc folder. During the installation procedure only the default driver jar is copied to your application server.
If you want to use a newer JDBC driver version or a different JDBC driver, you can modify the buildomatic properties seen in your default_master.properties file.
PostgreSQL Example
The buildomatic/conf_source/db/postgresql/jdbc folder contains these driver files:
postgresql-9.2-1002.jdbc3.jar
postgresql-9.2-1002.jdbc4.jar
If, for instance, you want to change the default driver used by PostgreSQL from type jdbc4 to jdbc3, edit your default_master.properties file:
<js-install>/buildomatic/default_master.properties
Uncomment and change:
# maven.jdbc.version=9.2-1002.jdbc4
To:
maven.jdbc.version=9.2-1002.jdbc3
When you next run a buildomatic command, such as deploy-webapp-pro, the jdbc3 driver will be copied to your application server.
MySQL Example
The buildomatic/conf_source/db/mysql/jdbc folder contains this driver file:
mariadb-java-client-1.1.2.jar
If, for instance, you want to use a JDBC driver built and distributed by the MySQL project, such as mysql-connector-java-5.1.30-bin.jar, you first need to download the driver from the MySQL Connector/J download location:
https://dev.mysql.com/downloads/connector/j/
Next, change your buildomatic configuration properties to point to this new driver.
Edit your default_master.properties file:
<js-install>/buildomatic/default_master.properties
Uncomment and change:
# jdbcDriverClass=com.mysql.jdbc.Driver
# maven.jdbc.groupId=mysql
# maven.jdbc.artifactId=mysql-connector-java
# maven.jdbc.version=5.1.30-bin
To:
jdbcDriverClass=com.mysql.jdbc.Driver
maven.jdbc.groupId=mysql
maven.jdbc.artifactId=mysql-connector-java
maven.jdbc.version=5.1.30-bin
Commercial JDBC Drivers
As of version 5.6.1, JasperReports Server includes the TIBCO JDBC drivers for the following commercial databases. You can connect to these databases using the TIBCO JDBC driver without additional steps. The driver name is included for reference:
• | Oracle — ji-oracle-driver-1.0.2.jar |
• | SQL Server — ji-sqlserver-driver-1.0.2.jar, |
• | DB2 — ji-db2-driver-1.0.2.jar |
These drivers require a valid JasperReports Server license. The driver is for use by JasperReports Server only, and the driver jar must be located under the jasperserver-pro directory, for example, <tomcat_home>/tomcat/jasperserverpro/web-inf/lib. |
If you're using the default settings for the driver, you don't need to edit default_master.properties.
You can also choose to use the driver supplied by the database vendor as described below. To do this, you must first obtain and install the driver you want, then modify your default_master.properties to use your driver.
Download an Optional JDBC Driver Jar
To use the driver supplied by the database vendor, you can optionally download and install it.
Download Driver Jar from Vendor Website:
You can download a commercial JDBC driver from the vendor's website. Here are some sites where you can download packages for supported databases:
• | http://www.microsoft.com/en-us/download/details.aspx?id=11774 (SQL Server) |
• | http://www.oracle.com/technetwork/indexes/downloads (Oracle) |
• | http://www-01.ibm.com/software/data/db2/linux-unix-windows/downloads.html (DB2) |
Once you have downloaded your driver, copy it to the correct location and configure your files as described in the sections below.
Collect Driver Jar from Existing Application:
You may already have a JDBC driver in an application running on your network. If so, you can simply copy that driver jar to the JasperReports Server install location.
Oracle Example
1. | Copy your Oracle driver to the following directory: |
<js-install>/buildomatic/conf_source/db/oracle/jdbc
2. | Change to the <js_install>/buildomatic directory and open default_master.properties in a text editor. |
3. | Go to the Additional Settings section in this file. |
4. | Go to the first setup item, Setup Standard Oracle JDBC Driver. |
5. | Follow the instructions to uncomment the required properties and enable your driver. The following example shows how to set up default_master.properties to point to a driver named ojdbc5-11.2.0.jar using SID: |
# 1) Setup Standard Oracle JDBC Driver## Uncomment and modify the value in order to change the default# 1a) Driver will be found here: <path>/buildomatic/conf_source/db/oracle/jdbc#maven.jdbc.groupId=oraclemaven.jdbc.artifactId=ojdbc5maven.jdbc.version=11.2.0.2[/code] jdbcDriverClass=oracle.jdbc.OracleDriverjdbcDataSourceClass=oracle.jdbc.pool.OracleConnectionPoolDataSource## 1b) Service Name # If you are using an oracle service name instead of an SID, your JDBC URL will# typically have a form similar to: jdbc:oracle:thin:@host:1521/servicename# To enable this you should uncomment the following line and add your service name# serviceName=[/code] |
If you're using an Oracle service name instead of an SID, uncomment the line serviceName= and add your service name.
6. | Save the default_master.properties file. |
7. | Open the <js_install>/buildomatic/conf_source/db/oracle/db.template.properties file in a text editor. |
8. | Locate the values for the TIBCO JDBC drivers and comment them out: |
# admin.jdbcUrl=jdbc:tibcosoftware:oracle://${dbHost}:${dbPort};${dbSidOrServiceNameProp} # ${AdditionalAdminProperties}# js.jdbcUrl=jdbc:tibcosoftware:oracle://${dbHost}:${dbPort};${dbSidOrServiceNameProp}# sugarcrm.jdbcUrl=jdbc:tibcosoftware:oracle://${dbHost}:${dbPort};${dbSidOrServiceNameProp}# foodmart.jdbcUrl=jdbc:tibcosoftware:oracle://${dbHost}:${dbPort};${dbSidOrServiceNameProp}[/code] |
9. | Uncomment the values for the vendor's Oracle driver and make sure they are as follows: |
10. | Save the file. |
SQL Server Example
1. | Copy your SQL Server driver to the following directory: |
<js-install>/buildomatic/conf_source/db/sqlserver/jdbc
2. | Change to the <js_install>/buildomatic directory and open default_master.properties in a text editor. |
3. | Go to the Additional Settings section in this file. |
4. | Go to the first setup item, Setup Standard SQL Server JDBC Driver. |
5. | Uncomment the required properties and enable your driver. The following example shows how to set up default_master.properties to point to a driver named sqljdbc-1.6.jar: |
# Default) Setup Tibco/Jaspersoft/Progress JDBC Driver## uncomment the following line for JDBC 4# jdbcDataSourceClass=tibcosoftware.jdbc.sqlserver.SQLServerDataSource40# 1) Setup Standard SQLServer JDBC Driver## Uncomment and modify the value in order to change the default# Driver will be found here: <path>/buildomatic/conf_source/db/sqlserver/jdbc#maven.jdbc.groupId=sqlservermaven.jdbc.artifactId=sqljdbcmaven.jdbc.version=1.6# admin.jdbcUrl=jdbc:sqlserver://${dbHostOrInstance};SelectMethod=cursorsqlserver.jdbcUrlProtocol=jdbc:sqlserverjdbcDriverClass=com.microsoft.sqlserver.jdbc.SQLServerDriverjdbcDataSourceClass=com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource[/code] |
6. | Make sure the following line is not commented: |
# admin.jdbcUrl=jdbc:sqlserver://${dbHostOrInstance};SelectMethod=cursor[/code] |
7. | Save the default_master.properties file. |
DB2 Example
1. | Copy your DB2 driver to the following directory: |
<js-install>/buildomatic/conf_source/db/db2/jdbc
2. | Change to the <js_install>/buildomatic directory and open default_master.properties in a text editor. |
3. | Go to the Additional Settings section in this file. |
4. | Go to the first setup item, Setup Standard DB2 JDBC Driver. |
5. | Follow the instructions to uncomment the required properties and enable your driver. |
6. | Add the following additional properties, setting the correct values for your installation. For example: |
7. | Save the default_master.properties file. |
Working with Oracle RAC
As of JasperReports Server 6.1, you can use Oracle 12c RAC with the TIBCO JDBC Oracle driver. This driver works with Oracle 12c RAC with the following settings:
• | Use Oracle 12C for non-CDB/PDB connection settings as described in Oracle without CDB/PDB. |
• | Use js-install.bat/sh minimal with Oracle 12c. This option does not install sample databases. |
To support additional functionality with Oracle RAC, you need to edit the connection string. For example, to support load balancing with multiple servers:
1. | Change to the <js_install>/WEB_INF directory and open js.jdbc.properties in a text editor. |
2. | Go to the "jasperserver repo db settings" section in this file. |
3. | Edit the metadata.jdbc.url file to include information about alternate servers and load balancing. The following example shows how to set up js.jdbc.properties to use Oracle RAC with load balancing with a primary server and three alternate servers: |
jdbc:tibcosoftware:oracle//server1:1521;ServiceName=SERVICE;AlternateServers=(server2:1521,server3:1521,server4:1521);LoadBalancing=true |
Application Server Copy-to Locations
When the deploy-webapp-pro buildomatic target is executed it copies the JDBC driver to the following default locations:
Tomcat 6 and 7: | <tomcat>/lib |
JBoss 5 | <jboss>/server/default/lib |
GlassFish: | <glassfish>/domains/domain1/lib/ext |
Recommended Comments
There are no comments to display.