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.

There can be multiple <datasource></datasource> tags. Each pair will map one of the connections in your catalog. You can define mapping connections for multiple connections for more than one catalog. The catalog connection name should be unique in the datasource.xml file, otherwise the latter <datasource> information will overwrite the previous ones.

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>

Element descriptions