About database connection

In many organizations, database specialists maintain the database. If this is true in your organization, you might not need to create and maintain tables within the database. However, to take full advantage of PowerBuilder, you should know how to work with databases.

Defining a data source

Using the ODBC administrator or other database connection utilities, you can define a database as a data source for your application. You can access the ODBC Administrator from the DataBase Profiles dialog box. The definitions of ODBC data sources are stored in the odbc.ini registry key.

Using database profiles to connect

Once you define a data source, you can create a database profile for it. A database profile is a named set of parameters that specifies a connection to a particular data source or database. Database profiles provide an easy way for you to manage database connections that you use frequently. When you are developing an application, you can change database profiles to connect to a different data source.

When database connections occur

PowerBuilder can establish a connection to the database in either the design-time or runtime environment. PowerBuilder connects to a database when you open certain painters, when you compile or save a PowerBuilder script that contains embedded SQL statements, or when you run a PowerBuilder application that accesses the database.

Note: The database connections in this section is for the PowerBuilder application only. To establish database connection for the mobile application, you will have to create a data source in the PowerServer. Detailed instructions are provided in the PowerServer Configuration Guide for .NET or PowerServer Configuration Guide for J2EE.

To maintain database definitions with PowerBuilder, you do most of your work using the Database painter. The Database painter allows you to:

  • Create, alter, and drop tables

  • Create, alter, and drop primary and foreign keys

  • Create and drop indexes

  • Define and modify extended attributes for columns

  • Drop views