About database connections

This section gives an overview of when database connections occur in PowerBuilder. It also explains why you should use database profiles to manage your database connections.

When database connections occur

Connections in PowerBuilder

PowerBuilder connects to your database when you:

  • Open a painter that accesses the database

  • Compile or save a PowerBuilder script containing embedded SQL statements (such as a CONNECT statement)

  • Execute an application that accesses the database

  • Invoke a DataWindow control function that accesses the database while executing an application

How PowerBuilder determines which database to access

PowerBuilder connects to the database you used last when you open a painter that accesses the database. PowerBuilder determines which database you used last by reading a setting in the registry.

What's in this book

This book describes how to connect to your database when you are working in the PowerBuilder development environment.

For instructions on connecting to a database in a PowerBuilder application, see the section called “Database connections” in Application Techniques.

Using database profiles

What is a database profile?

A database profile is a named set of parameters stored in the registry that defines a connection to a particular database in the PowerBuilder development environment.

Why use database profiles?

Creating and using database profiles is the easiest way to manage your database connections in PowerBuilder because you can:

  • Select a database profile to establish or change database connections. You can easily connect to another database anytime during a PowerBuilder session. This is particularly useful if you often switch between different database connections.

  • Edit a database profile to modify or supply additional connection parameters.

  • Use the Preview tab page to test a connection and copy the connection syntax to your application code.

  • Delete a database profile if you no longer need to access that data.

  • Import and export profiles.

Because database profiles are created when you define your data and are stored in the registry, they have the following benefits:

  • They are always available to you.

  • Connection parameters supplied in a database profile are saved until you edit or delete the database profile.