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
All database interfaces (only in the development environment)
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:
-
Select the check box
(Default) Stays connected to the database throughout your PowerBuilder session and closes the connection when you exit.
-
Clear the check box
Opens the database connection when a painter requires it and closes the connection when you close a painter or finish compiling a script
Default value
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:
-
Working in the development environment
You must be working in the development environment.
-
Using default connection information
PowerBuilder must use the most recently used connection information in the Windows registry to connect to the database. Keep Connection Open has no effect when you select a database profile to connect to the database.
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.