Keep Connection Open

Description

By default, PowerBuilder opens a database connection the first time you open a painter requiring a connection, and stays connected throughout the session until you exit.

When you connect to a database in the PowerBuilder development environment without using a database profile, you can set the Keep Connection Open database preference to specify when PowerBuilder closes the database connection.

Keep Connection Open applies only when connecting to a database in the PowerBuilder development environment without using a database profile. The setting of Keep Connection Open has no effect when you use a database profile to connect in PowerBuilder.

Applies to

Context

In an application

You cannot set the Keep Connection Open database preference in code.

In the development environment

In the Database painter, select or clear the Keep Connection Open check box in the Database Preferences dialog box as follows:

Default

The Keep Connection Open check box in the Database Preferences dialog box is selected by default.

Usage

Requirements for using Keep Connection Open To use the Keep Connection Open database preference, both of the following must be true:

What happens If you meet both of these requirements, clearing the Keep Connection Open check box opens a database connection only when you are working in a painter that requires a connection, and closes the connection at other times. This can save you money if you are accessing a database that charges for connect time.