### Configuring the datasource.xml file

In order to enable you to conveniently set different connections in JReport Enterprise 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 Enterprise 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>

#### Element descriptions

- catalog-connection-name
  Specifies the name of the catalog connection that you want to substitute. Note that this is the connection name that you can see in JReport Catalog Browser. A unique connection name in a catalog is suggested.
- connection-type
  Specifies the connection type, which can be either JNDI or JDBC.
- jndi-datasource
  If you are using a JNDI data source, specify the JNDI data source name you defined in your Java application server which you want to use as the substitute connection.
- driver & url
  If you are using a JDBC data source, specify the JDBC Driver and URL in these two attributes.

Notes:

- 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.
- You can choose whether to provide database user and password information for the JNDI connection, using the `user` and `password` attributes. If the user and password information is provided in this file, it will be used to set up the connection regardless of the settings defined in your application server. Otherwise, the settings defined in your application server will be used. Specially, for WebLogic users, you should provide user name and password for WebLogic console instead of the database.