Connecting to a Database Server

From InterBase

Go Up to Controlling Connections

There are two ways to connect to a database server using a database component:

  • Call the Open method.
  • Set the Connected property to True.

Setting Connected to True executes the Open method. Open verifies that the database specified by the Database or Directory properties exists, and if an OnLogin event exists for the database component, it is executed. Otherwise, the default Login dialog box appears.

When a database component is not connected to a server and an application attempts to open a dataset associated with the database component, the database component’s Open method is first called to establish the connection. If the dataset is not associated with an existing database component, a temporary database component is created and used to establish the connection.

Once a database connection is established the connection is maintained as long as there is at least one active dataset. If a dataset is later opened which uses the database, the connection must be reestablished and initialized. An event notifier procedure can be constructed to indicate whenever a connection to the database is made or broken.

Advance To: