When you perform a database switch, you use a SwitchingDataSource to switch between two product catalog/price lists data sources. The SwitchingDataSource can switch from one underlying data source to another. For example, the method could switch from a test database to a production database.

This section describes the configuration required before performing a database switch. Use CIM to configure data source components. Once you have configured these components, you do not need to change them unless your data sources change.

The Nucleus components used in this example are located at /atg/commerce/jdbc.

Follow these configuration steps to prepare to switch the data source used by the product catalog and price lists repositories:

  1. Create the underlying data sources. Alternatively, you can use the data sources provided with the default configuration of Oracle ATG Web Commerce. They are:

    /atg/commerce/jdbc/ProductCatalogDataSourceA and /atg/commerce/jdbc/ProductCatalogDataSourceB.

    These data sources are used as the example data sources in this procedure.

  2. Configure the dataSource property in each of the data sources.

    The dataSource property contains a reference to the data source that stores information for connection to a database. By setting this property for ProductCatalogDataSourceA and ProductCatalogDataSourceB, you control to what database each data source points.

  3. Create a SwitchingDataSource. Alternatively, you can use ProductCatalogSwitchingDataSource, which is located in Nucleus at /atg/commerce/jdbc/. This SwitchingDataSource is provided with the default configuration of Oracle ATG Web Commerce.

    A SwitchingDataSource is a DataSource that can switch between two or more underlying data sources. In a SwitchingDataSource, all DataSource method calls are passed through to the DataSource specified in the currentDataSource property, which is defined at run time. For more information on SwitchingDataSource, see the ATG Platform API Reference and the ATG Installation and Configuration Guide.

    The following example shows the configuration for the ProductCatalogSwitchingDataSource included with Commerce.

    # A map from data source names to data sources
    # The name of the data source that should be used

    The dataSources property of a SwitchingDataSource is a mapping of data source names to the Nucleus path of each data source.

    The initialDataSource is the data source used.

  4. Configure the ProductCatalog repository to use the SwitchingDataSource. By default, the ProductCatalog repository does not use this data source, so you must add the following to the ProductCatalog.properties file at localconfig/atg/commerce/catalog/:


  5. Configure the PriceLists repository to use the SwitchingDataSource. By default, the PriceLists repository does not use this data source, so you must add the following to the PriceLists.properties file at localconfig/atg/commerce/pricing/priceLists/:


  6. Configure the switchingDataSource property of the ProductCatalogSwitcher form handler (class atg.droplet.sql.SwitchDataSourceFormHandler) to use the SwitchingDataSource. The Switch UI uses the ProductCatalogSwitcher form handler to perform the database switch; the switchingDataSource property specifies the specific SwitchingDataSource controlled by the form handler.

  7. Perform the database switch as described in Performing a Database Switch.

Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices