## Creating a catalog

A report can only exist within a catalog. Therefore you must create and open a catalog before you create or edit a report.

A catalog is represented at the operating system level as a directory that contains the catalog file (.cat) as well as the other report objects.

To create a catalog:

1. In JReport Designer, click File > Catalog Management > New Catalog on the menu bar.

   If necessary, JReport Designer will prompt you to save changes to the current open catalog. Only one catalog can be open at a time.

2. In the New Catalog dialog, enter the name for the catalog in the Name field.
3. In the Data Source Name field, input the name for the data source that will be created along with the catalog (when creating a catalog, by default, a data source will be created in the catalog at the same time). Make sure the name you give follows the Java class naming rule.
4. Specify the path where to save the catalog in the Directory field. You can also click the button to browse to and select the directory in which to create the catalog.
5. Click OK to create the catalog.

   The Catalog Browser displays with a data source created for the catalog. You can then set up the required connections to connect with the data source (for details about setting up connections, see Data Source Connections).

   A data source in a catalog can be connected with multiple connections, then when you create queries in such data source, you can mash-up multiple data resources in the queries, which come from all the connections the data source is connected with.

Note: The catalog name must include the extension (.cat or .xml) and the directory you choose must not already contain a catalog file.

JReport Designer supports the Multiple Data Sources feature, which means in one catalog, you can add as many data sources as you need.

To add another data source to a catalog, follow the steps below:

1. Do either of the following:
   - In the Catalog Browser, select the data source node, then click the New Data Source button on the Catalog Browser toolbar.
   - Click File > New > Data Source on the menu bar.
2. In the New Data Source dialog, specify a name for the data source in the Data Source Name field, select the connection type, then click OK.
3. Set up the first connection in the data source according to your requirements.

When multiple data sources are created in a catalog, you need to specify which data source will be the default one for the catalog (by default, the data source that is created along with the catalog is the default data source of the catalog). To do this, right-click the data source which you want to use as the default data source, then click Set as Default on the shortcut menu. A catalog must have one and only one default data source.

In addition, you can rename and delete the data sources in a catalog if required.

- To rename a data source, right-click the data source and select Rename from the shortcut menu. In the renaming box, enter a new name for the data source, then click outside the box to confirm the change.
- To delete a data source, right-click the data source, on the shortcut menu, click Delete. The default data source cannot be deleted.