In many database-dependent applications, you may want to make changes in an offline database and then switch over your live application so that the inactive database becomes the live database. ATG’s switching facility is based on a class named atg.service.jdbc.SwitchingDataSource. You can use a SwitchingDataSource in place of a regular data source (such as atg.service.jdbc.MonitoredDataSource). The SwitchingDataSource can be switched between two or more underlying DataSources. All DataSource method calls are passed through to the DataSource specified by the currentDataSource property of the SwitchingDataSource. Note that each DataSource that the SwitchingDataSource points to must be of class atg.nucleus.JNDIReference, with a JNDIName property that points to an application server data source. See Configuring Data Sources and Transaction Management for more information.

The switching database is meant to complement the DBCopier components. For example, if you are using ATG Commerce, you would update an inactive database, switch your live site to that database, then copy the currently-active database to the inactive database using the database vendor’s native bulk copy tools.

Note: Unlike DBCopier, ATG’s switching facility is a JDBC mechanism.

To set up and use a database switching service:

  1. Configure DataSources that connect to your live and inactive databases.

  2. Configure a SwitchingDataSource component, as described in Configuring a SwitchingDataSource.

  3. Configure the Repository components that use the DataSources to point to the SwitchingDataSource. Also set the Repository components’ cacheSwitchHot property, as described in Database Switching and Repository Caches.

Important: If you have multiple independent ATG clusters that share a single SDSRepository, make sure each cluster uses a unique set of SwitchingDataSource names. Otherwise, the clusters will interfere with each other during the switching process.

loading table of contents...