The power of ABL is in the simplicity of working with databases. During application development and when running your application, it must be connected to a database.

If you are setting up your own development environment, you need a sample database to work with. If your application database is not yet available, there are sample databases that you can copy and use. For more information see Create a database with the PRODB utility.

Before connecting an application to a database you may have to start the database server. For more information on starting a database server see Starting up and shutting down a database server. You can also connect to a database without starting a database server by running in single-user mode. In this mode only one user can access the database.

There are two ways to connect the database to the application:
  • CONNECT statement — The CONNECT statement is a simple, programmatic mechanism to establish a connection to one or more databases from within an ABL procedure or class. This step must be done in a file before any files can use the database.
    The following code connects to a sample database in the OpenEdge installation directory in single-user mode:
    CONNECT WRK/db/Sports2020 -1.
    The following code connects to a database on the specified host and port:
    CONNECT WRK/db/Sports2020 -H dbserver -S 1900 NO-ERROR.
  • Startup parameters — You can use startup parameters to establish a connection to one or more databases. In the following example, the -db startup parameter is used to specify the name of the database.
    prowin -db sports2020 -1
    For more information see Client startup command syntax.