Associating a Database Component with a Session

From RAD Studio
Jump to: navigation, search

Go Up to Connecting to databases with TDatabase Index

Attention: The Borland Database Engine (BDE) has been deprecated, so it will not be enhanced. For instance, BDE will never have Unicode support. You should not undertake new development with BDE. Consider migrating your existing database applications from BDE to dbExpress.

All database components must be associated with a BDE session. Use the SessionName, establish this association. When you first create a database component at design time, SessionName is set to "Default", meaning that it is associated with the default session component that is referenced by the global Bde.DBTables.Session variable.

Multi-threaded or reentrant BDE applications may require more than one session. If you need to use multiple sessions, add Bde.DBTables.TSession components for each session. Then, associate your dataset with a session component by setting the SessionName property to a session component's SessionName property.

At run time, you can access the session component with which the database is associated by reading the Session property. If SessionName is blank or "Default", then the Session property references the same TSession instance referenced by the global Session variable. Session enables applications to access the properties, methods, and events of a database component's parent session component without knowing the session's actual name.

For more information about BDE sessions, see Managing Database Sessions.

If you are using an implicit database component, the session for that database component is the one specified by the dataset's SessionName property.

See Also