RAD Studio |  |

Connecting to databases with TDatabase
Collapse All

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.

Topics

Name | Description
Associating a Database Component with a Session | 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 Session variable. Multi-threaded or reentrant BDE applications may require more than one session. If you need to use multiple sessions, add 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 runtime, you can access the session component... more
Using TDatabase to Connect to Databases | When a Delphi application uses the Borland Database Engine (BDE) to connect to a database, that connection is encapsulated by a TDatabase component. A database component represents the connection to a single database in the context of a BDE session. TDatabase performs many of the same tasks as and shares many common properties, methods, and events with other database connection components. These commonalities are described in Connecting to databases. In addition to the common properties, methods, and events, TDatabase introduces many BDE-specific features. These features are described in the following topics: Associating a Database Component with a Session... more
Opening a Connection Using TDataBase | As with all database connection components, to connect to a database using TDatabase, you set the Connected property to True or call the Open method. This process is described in Connecting to a database server. Once a database connection is established the connection is maintained as long as there is at least one active dataset. When there are no more active datasets, the connection is dropped unless the database component's KeepConnection property is True. When you connect to a remote database server from an application, the application uses the BDE and the CodeGear SQL Links driver to... more
Understanding Database and Session Component Interactions | In general, session component properties provide global, default behaviors that apply to all implicit database components created at runtime. For example, the controlling session's KeepConnections property determines whether a database connection is maintained even if its associated datasets are closed (the default), or if the connections are dropped when all its datasets are closed. Similarly, the default OnPasswordevent for a session guarantees that when an application attempts to attach to a database on a server that requires a password, it displays a standard password prompt dialog box. Session methods apply somewhat differently. TSession methods affect all database components, regardless... more
Using Database Components in Data Modules | You can safely place database components in data modules. If you put a data module that contains a database component into the Object Repository, however, and you want other users to be able to inherit from it, you must set the HandleShared property of the database component to True to prevent global name space conflicts.
Setting BDE Alias Parameters | At design time you can create or edit connection parameters in three ways: Use the Database Explorer to create or modify BDE aliases, including parameters. For more information about these utilities, see their online Help files. Double-click the Params property in the Object Inspector to invoke the String List editor. Double-click a database component in a data module or form to invoke the Database Properties editor. All of these methods edit the Params property for the database component. Params is a string list containing the database connection parameters for the BDE alias associated with a database component. Some typical... more
Identifying the Database | AliasName and DriverName are mutually exclusive properties that identify the database server to which the TDatabase component connects. AliasName specifies the name of an existing BDE alias to use for the database component. The alias appears in subsequent drop-down lists for dataset components so that you can link them to a particular database component. If you specify AliasName for a database component, any value already assigned to DriverName is cleared because a driver name is always part of a BDE alias. You create and edit BDE aliases using the Database Explorer . For more information about creating and maintaining BDE... more

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