You can configure your connection to the database in one of two ways:
| • | You can configure the connection during installation of JasperReports Server by configuring the external.jdbcDriverClass, external.jdbcUrl, external.dbUsername, and/or external.dbPassword properties prior to installation or upgrade. At this time, you can optionally choose to encrypt any of the database connection parameters. This is the preferred method for setting the database connection parameters. See the JasperReports Server Administrator Guide for more information. |
| • | If you have an existing JasperReports Server, you can configure the connection properties directly in your sample-applicationContext-externalAuth-db-mt.xml file. In this case, the properties, including the password, cannot be encrypted. |
Setting Database Connection Parameters in default_master.properties
The preferred method for setting the database connection parameters is to configure the external.jdbcDriverClass, external.jdbcUrl, external.dbUsername and dbPassword properties in the default_master.properties file prior to installation or upgrade. As of JasperReports Server 5.6, the default configuration of the externalDataSource bean in sample-applicationContext-externalAuth-db-mt.xml uses context properties for the database connection properties:
<bean id="externalDataSource" class="com.jaspersoft.jasperserver.api.security. externalAuth.wrappers.spring.jdbc.JSDriverManagerDataSource"> <property name="driverClassName" value="${external.jdbc.driverClassName}"/> <property name="url" value="${external.jdbc.url}"/> <property name="username" value="${external.jdbc.username}"/> <property name="password" value="${external.jdbc.password}"/></bean>[/code] |
To configure these properties using default_master.properties, follow these steps:
| 1. | Open default_master.properties in a text editor. |
| 2. | Locate the following properties and set them for your LDAP server as follows: |
| • | external.jdbcDriverClass property – The name of the JDBC driver class for your database. Make sure the driver jar library is available on the classpath; for example, you can place the jar in the lib directory of your application server or in the <js-webapp>/lib directory. |
| • | external.jdbcUrl property – The JDBC URL for your database server, including the hostname, port, and database you want to access. |
| • | external.dbUsername property – The username of your database administrator. |
| • | external.dbPassword property — The password of your database administrator. |
| 3. | At this time, you can optionally choose to encrypt any of the LDAP connection parameters. |
The following example shows the syntax of the properties in the default_master.properties file:
external.jdbcDriverClass=com.mysql.jdbc.Driverexternal.jdbcUrl=jdbc:mysql://127.0.0.1:3306/external_sso_testexternal.dbUsername=usernameexternal.dbPassword=password[/code] |
To encrypt the password property, you would also set the following:
encrypt=truepropsToEncrypt=dbPassword,external.dbPassword[/code] |
See the JasperReports Server Administrator Guide for more information on encrypting passwords using buildomatic.
Setting Database Connection Parameters Manually
| If you configured your database connection during JasperReports Server installation, do not set the parameters using externalDataSource. You can verify whether the parameters are set by looking at the default_master.properties file. |
To set the connection parameters for the external database server directly in the application context file, configure the externalDataSource helper bean as follows:
| 1. | In sample-applicationContext-externalAuth-db-mt.xml, locate the externalDataSource bean. |
| 2. | Specify the following information: |
| • | driverClassName property – The name of the JDBC driver class for your database. Make sure the driver jar library is available on the classpath; for example, you can place the jar in the lib directory of your application server or in the <js-webapp>/lib directory. |
| • | url property – The JDBC URL for your database server, including the hostname, port, and database you want to access. |
| • | username property – The username of your database administrator. |
| • | password property – The password of your database administrator. |
The following is an example of the connection information for a MySQL database:
<bean id="externalDataSource" class="com.jaspersoft.jasperserver.api.security. externalAuth.wrappers.spring.jdbc.JSDriverManagerDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://127.0.0.1:3306/external_sso_test"/> <property name="username" value="username"/> <property name="password" value="password"/></bean>[/code] |
Recommended Comments
There are no comments to display.