Session-State Database Schema
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Session-State Database Schema

Visual Studio .NET 2003

For the database implementation of the ATL Server session-state services, the CDBSessionServiceImplT class communicates with a database through CDBSession. This class template in turn defaults to using CDefaultQueryClass to provide the SQL queries used for accessing the database. CDefaultQueryClass expects the database to have two tables, one for storing session variables named SessionVariables, and one for storing session reference information named SessionReferences. The schema of the two tables is defined as follows:


Column Name Type Description
1 SessionID char[MAX_SESSION_KEY_LEN] Session name
2 VariableName char[MAX_VARIABLE_NAME_LENGTH] Variable name
3 VariableValue varbinary[MAX_VARIABLE_VALUE_LENGTH] Variable value


Column Name Type Description
1 SessionID char[MAX_SESSION_KEY_LEN] Session name
2 LastAccess Datetime Date and time of last access
3 RefCount INT Count of current references on this session
4 TimeoutMS Int Timeout value for the session

If SQL Server is being used to host the session database, the SQL script, SessionServices.sql, which can be found in the \VC7\bin directory of your Visual Studio installation, can be used to create the necessary tables.

As an implementation class, CDBSessionServiceImplT serves a behind-the-scenes role and should be used in your code only as a template parameter to CSessionStateService. See Providing Session-State Services for more information.

See Also

Session-State Services | CMemSessionServiceImpl | Session-State Reference

© 2015 Microsoft