PowerServer uses a cloud-based architecture, which changes how database connections work compared to traditional PowerBuilder client/server (C/S) apps. Here are the key differences.
Long-running vs. Short-lived Connections
In a PowerBuilder traditional client/server application, the client connects to the database when CONNECT statement is executed. The same connection stays open for the entire session, until DISCONNECT is called. This is called a long-running connection. So in long-running connections
1) the database connection can remain open through the entire lifespan of the application;
2) for a particular client, the database connection is always the same one during the entire session.
In the installable cloud application, the database connection is made by PowerServer (not the client). The connection is automatically closed and returned to a pool after each transaction. This is called a short-lived connection. So in short-lived connections, for a particular client, it may use more than one connections during a session.
Benefits of short-lived connections:
-
Better support for high concurrency.
-
Lower risk of table deadlocks.
-
More secure and less impacted by network issues.
Note
Limitation
Features that depend on persistent connections (like temporary tables) may not work as expected. For example, a temporary table created in the long-running connection can be used and accessed until the application is closed, while a temporary table created in the short-lived connection will no longer be accessible when that connection ends and returns to the pool.
Enable the LongConnection DBParm if your logic depends on persistent connections. For more information, refer to Long connection.
Client-to-Server vs. Server-to-Server Connections
In the PowerBuilder traditional client/server application, the database connection is made directly from the client to the database server (client-to-server connections). The database driver must be installed on each client. The connection information (including user ID, password, DB connection string, etc.) must be stored on each client.
In the PowerServer installable cloud application, the database connection is made from PowerServer to the database server (server-to-server connections). The data provider (including driver) is installed in PowerServer, and the connection information is stored securely in a connection cache in PowerServer. The PowerServer and the database can be on the LAN behind the firewall.
Steps to set up server-to-server connections in PowerServer installable cloud app (for detailed instructions, refer to this section)
-
Create a connection cache
The cache is created in the IDE and used by the IDE to connect with the database and generate C# models; when the application is deployed from the IDE to PowerServer, the cache is also deployed to PowerServer and used by PowerServer to connect with the database at runtime.
-
Map transaction object(s) to the cache.
For each transaction object used in the application, it must be mapped with a cache. This can be done in the PowerServer project painter or in code.
-
Download .NET Core data provider
Unlike the traditional client/server app which connects with the database through a local native driver, the installable cloud app relies on the PowerServer Web APIs and the .NET data provider to connect with the database.
The IDE and PowerServer will automatically download and install the data provider if you have selected to accept the license terms of the provider in the PowerServer project painter