RAD Studio
ContentsIndex
PreviousUpNext
Specifying Default Database Connection Behavior

KeepConnections provides the default value for the KeepConnection property of implicit database components created at runtime. KeepConnection specifies what happens to a database connection established for a database component when all its datasets are closed. If True (the default), a constant, or persistent, database connection is maintained even if no dataset is active. If False, a database connection is dropped as soon as all its datasets are closed.

Note: Connection persistence for a database component you explicitly place in a data module or form is controlled by that database component's KeepConnection property. If set differently, KeepConnection for a database component always overrides the KeepConnections property of the session. For more information about controlling individual database connections within a session, see Managing database connections.
KeepConnections should be set to True for applications that frequently open and close all datasets associated with a database on a remote server. This setting reduces network traffic and speeds data access because it means that a connection need only be opened and closed once during the lifetime of the session. Otherwise, every time the application closes or reestablishes a connection, it incurs the overhead of attaching and detaching the database.
Note: Even when KeepConnections is True for a session, you can close and free inactive database connections for all implicit database components by calling the DropConnections method. For more information about DropConnections, see Dropping inactive database connections.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!