Migrating from direct connection to GAS

Understand the changes in database connection behavior and what to review when transitioning to HTTP-based deployment using Genero Application Server (GAS).

What changes, and what to review

With direct connection, each person using the application logs in to the server with their own operating system account, and the application runs under that account. With GAS, the application runs under the operating system user that runs the GAS dispatcher, the same user for everyone. The following table lists what this changes, and what to review in your application source and configuration.

Table 1. Areas to review when moving from direct connection to GAS
What changes With GAS What to review
Process owner The user that runs the GAS dispatcher runs the application, not the person using it. Environment variables that hold the user name, such as USERNAME on Windows or LOGNAME and USER on Linux, return the name of that user in every session. Code that identifies who is using the application from the operating system user name.
File access The application reads and writes files with the access rights of the user that runs the GAS dispatcher. Files the application creates belong to that user. Access rights on the program files, resources, and directories the application reads or writes. For details, go to Managing user access rights.
File paths Environment variables such as $HOME resolve to the home directory of the user running the GAS dispatcher. Paths built from these variables therefore point to that user's directories. If your application requires a different location, configure it in the application configuration file. For details, go to Application configuration file.
SQL USER value The USER keyword in SQL statements may return the GAS user, unless the database connection sets the user explicitly. SQL statements that rely on USER to identify who is using the application. For details, refer to the Database users and security topic in the Genero Business Development Language User Guide.

Connecting to the database

After GAS starts the application, the application must connect to the database with valid credentials. The most common method is a CONNECT TO statement with a user name and password:


MAIN
DEFINE uname, upswd VARCHAR(50)
...
CONNECT TO "dbsource" USER uname USING upswd
...
END MAIN

To simplify user management and improve security in web applications with dynamic user populations, use predefined database users mapped to application roles. For details, refer to the Database users and security topic in the Genero Business Development Language User Guide.

Depending on your architecture, the application may still need its own authentication. You can implement it locally against a database, or delegate it to an identity provider using Single Sign-On (SSO):

  • For database-based authentication, refer to Database user authentication in the Genero Business Development Language User Guide.
  • For SSO-based authentication, refer to Connect to the application database with SSO in the Single Sign-On User Guide.