# Enabling External Client State Management

You enable client state management in the ColdFusion Server using the Administrator to specify a data source repository where you want to store client variables.

Although you can select and use an existing data source to store client variables, Allaire recommends creating a new data source specifically for the purpose of storing client variables. By separating data sources, you can more easily define security options for the data sources used in your ColdFusion environment.

When creating a new data source for client variables, you do not need to create any tables in the data source. ColdFusion automatically creates the tables necessary to store client variables.

| To create a client variable data source:

1. Open the ColdFusion Administrator to the Data Sources page.
2. Enter a data source name in the text entry box and click Add.
3. In the Create Data Source page, enter information about the new data source location (path) as well as other options.

   Excel and Text data sources do not appear as valid data sources for use in configuring an external client data source repository. Neither data source type supports the SQL required for the client variable repository. In addition, OLE DB data sources are not supported for use as a client data source repository.

4. Click Create to create the new data source.

| To enable your client variable data source:

1. Open the ColdFusion Administrator to the Variables page, which is in the Server group.
2. Select the name of the data source you want to use for storing client variables in the drop down list box, and click Add.
3. On the Create Client Variable Storage page, select the options you want.

## Client variable storage options

When you configure a data source for client variable storage, you have several options for configuring the data source:

- Purging variables older than a specified number of days
- Configuring global client variable updates
- Automatically creating tables in the client variable data source

## Purge client variables

Ordinarily, you don't want to have client variables preserved indefinitely. ColdFusion allows you to set a limit to the length of time a client variable remains active. You can configure your client variable data source to expire client variables after some number of days you specify.

As an example of how this can be useful, take the case of an online store. A user adds items to his or her shopping basket, the details of which are stored as client variables in a ColdFusion data source, but never completes the transaction, instead, choosing to end the session. You want to be able to easily clear the contents of the shopping cart after some number of days. Enabling ColdFusion to purge clients can help keep your client variables data source from getting cluttered with data you don't need.

## Disable global client variable updates

By default ColdFusion updates client variables for every page request. Use this option if you don't want ColdFusion to perform these updates. When updates are disabled, ColdFusion only updates global client variables when they are first created and when they are updated. Since updating global client variables for every page request requires a trip to the data source and back, disabling updates helps to improve the performance of your application pages.

## Create client variable data source tables

Use this option to allow ColdFusion to create the tables necessary for client variables when you first configure the data source for this purpose. As you configure other servers in your cluster to use this client variables data source, be sure to disable the option for ColdFusion to create the necessary tables. If you inadvertently enable automatic table generation, ColdFusion generates a SQL error because it tries to create tables that already exist.