Configuring the datasource.xml file

In order to enable you to conveniently set different connections in JReport Server, a configuration file, datasource.xml, is provided with which you can define the connection to use at runtime by setting up connection mapping information such as the JDBC driver, URL, or JNDI data source name, user and password, depending on the data source your application uses.

The datasource.xml file is located in the <install_root>\bin directory. Change this file according to the data source you want to use. Two types of connections are supported by JReport Server. They are JNDI data source connection and JDBC connection.

The content of the datasource.xml file is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<datasource-mapping>
    <datasource>
        <catalog-connection-name>Connection1</catalog-connection-name>
        <connection-type>JNDI</connection-type>
        <jndi-datasource>Sample</jndi-datasource>
    </datasource>
    <datasource>
        <catalog-connection-name>Connection2</catalog-connection-name>
        <connection-type>JDBC</connection-type>
        <driver>sun.jdbc.odbc.JdbcOdbcDriver</driver>
        <url>jdbc:odbc:jinfonet</url>
        <user>Username</user>
        <password>Password</password>
    </datasource>
</datasource-mapping>

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 datasource.xml file.

Element descriptions

Notes: