Configuring the server database in a standalone environment
When JReport Server is running in a standalone environment, you can configure the database for it remotely on the JReport Administration page. Also, since the server database configuration information is stored in the dbconfig.xml file in the directory <install_root>\bin
, you can also configure the server database in this file.
The following presents the two ways of configuring the server database in a standalone environment:
Configuring on the JReport Administration page
- Log onto the JReport Administration page, click Data on the system toolbar and then select System DB, Realm DB, or Profiling DB from the drop-down menu according to your requirement.
Note: The Profiling DB option is not shown by default on the drop-down menu. In order to make it shown, you should set the server.profiling.enable property to true in the server.properties file in the <install_root>\bin
directory.
- Select a realm if it is the Realm DB or Profiling DB panel.
- In the Configuration tab, select a DBDriver from the Driver drop-down list and provide the driver class path information in the Driver Class Location field.
Note: For HSQLDB and Derby databases, you do not need to specify the Driver Class Location. For all other databases, you will have to provide the driver class path information unless it has already been added to the class path of setenv.bat (setenv.sh on Unix) file during installation or by editing the setenv.bat file.
- Type a valid URL that can be used to establish a connection to the database. The valid format of the URL should be provided by the DBDriver vendor.
- Provide the user ID and password.
- To test the connection, click Test. To update the database configuration and to apply the settings, click Update and then restart the server to finalize the function.
Configuring in the dbconfig.xml file
In dbconfig.xml, you can configure the server database using one of two methods. One is to specify the URL, driver, user and password individually. This method of configuration can be modified through the JReport Administration page. For example:
<database name="systemtables/realmtables/profile">
<url>...</url>
<driver>...</driver>
<user>...</user>
<password>...</password>
</database>
|
Note: The <user> and <password> information is encrypted. The <user> and <password> tags will be replaced by the <encrypt-sign> tag after JReport Server's startup as follows:
<encrypt-sign>enDkq7srM9cHhoUwzYXJ3NvcDIYk</encrypt-sign>
If you want to change user or password, delete the <encrypt-sign> tag and add the <user> and <password> tags in the dbconfig.xml file.
The other is to use the <datasource> tag. For example:
<database name="systemtables/realmtables/profile">
<datasource>
jdbc://user:password@jdbc:odbc:jreport-realmtables#driver=sun.jdbc.odbc.JdbcOdbcDriver
</datasource>
</database>
|
Here are two examples for your reference:
- The following example is for Oracle. Modify the dbconfig.xml file as follows:
<?xml version="1.0" encoding="UTF-8"?> <dbconfig> <workspace name="systemRealm"> <database name="systemtables"> <url>jdbc:oracle:thin:@dbhost:1521:SystemDB</url> <user>test</user>
<password>1234</password>
<driver>oracle.jdbc.OracleDriver</driver> </database> </workspace> <workspace name="defaultRealm"> <database name="realmtables"> <url>jdbc:oracle:thin:@dbhost:1521:RealmDB</url> <user>test</user>
<password>1234</password>
<driver>oracle.jdbc.OracleDriver</driver> </database> </workspace> </dbconfig>
|
- The following example is for a DataDirect driver. Modify the dbconfig.xml file as follows:
<?xml version="1.0" encoding="UTF-8"?>
<dbconfig>
<workspace name="systemRealm"> <database name="systemtables">
<url>
jdbc:datadirect:sqlserver://dbhost:1433;DatabaseName=SystemDB
</url>
<user>test</user>
<password>1234</password>
<driver>
com.ddtek.jdbc.sqlserver.SQLServerDriver
</driver>
<dbtype>Microsoft SQLServer</dbtype>
</database>
</workspace>
<workspace name="defaultRealm">
<database name="realmtables">
<url>
jdbc:datadirect:sqlserver://dbhost:1433;DatabaseName=RealmDB
</url>
<user>test</user>
<password>1234</password>
<driver>
com.ddtek.jdbc.sqlserver.SQLServerDriver
</driver>
<dbtype>Microsoft SQLServer</dbtype>
</database>
</workspace>
</dbconfig>
|
Notes:
- Usually, JReport Server automatically creates database tables the first time it is started. The database information that JReport Server uses is defined in the dbconfig.xml file. However, if the user ID defined in this file does not have the permission to create tables in the database, JReport Server will fail to complete the operation. In this case, you will need another user, such as the database administrator (who holds the relevant permissions), to create a set of empty tables in the user's schema using the provided SQL files. These SQL files can be found in
<install_root>\script_files
.
- For MySql 5.0.xx, the letters in user name should all be lowercase.
- Because of the compatibility between the third package Quartz used by JReport Server and the driver of Oracle database, the Quartz package will throw exception when the class path of oracle database driver is added into dbconfig.xml. To avoid this problem, when the JReport server works with Oracle database, do not set database driver class path in dbconfig.xml.