FireDAC TFDConnection DriverName and SSLMode Behavior After PostgreSQL ODBC Driver Upgrade in RAD Studio 12.0
0 reputation · 26 Jul 2023, 23:56 UTC
0 reputation · 26 Jul 2023, 23:56 UTC
RAD Studio 12.0 supports FireDAC connections to PostgreSQL 15, typically requiring SSLMode=Require or Prefer in the connection parameters to match server encryption settings. The goal is to operate a low-traffic workload under the RAD Studio Community Edition license while keeping idle database connections to a minimum.
It is not documented whether TFDConnection automatically detects an upgraded PostgreSQL ODBC driver or whether DriverName must be updated manually after the driver changes. It is also unclear whether disabling pooling with Pooling=False and PoolSize=1 reliably closes idle connections without interfering with active SSL sessions.
Does TFDConnection require a manual DriverName update when the PostgreSQL ODBC driver version changes in RAD Studio 12.0? Is Pooling=False safe to use with SSLMode=Require for a low-traffic Community Edition deployment?
34275 reputation · 27 Jul 2023, 05:02 UTC
No, TFDConnection does not require a manual DriverName update when the PostgreSQL ODBC driver version is upgraded. In FireDAC, DriverName='ODBC' acts as a generic identifier that tells the framework to use the ODBC bridge. The actual version of the PostgreSQL driver is managed by the Windows ODBC Data Source Administrator (odbcad32.exe). As long as the driver name registered in the system (e.g., "PostgreSQL Unicode") remains consistent, FireDAC will utilize the updated binary without code changes.
Yes, Pooling=False is safe to use with SSLMode=Require. When pooling is disabled, TFDConnection.Close triggers the release of the connection handle back to the ODBC Driver Manager, which in turn signals the PostgreSQL driver to terminate the physical session and tear down the SSL tunnel.
While Pooling=False effectively minimizes idle connections on the server, it introduces a performance penalty for low-traffic workloads. Every Open call requires a full TCP handshake and a complete SSL negotiation. For a Community Edition deployment, this is functionally correct but may result in noticeable latency during the initial connection phase of each request.
TFDConnection.Params:
DriverName=ODBCSSLMode=Require (This is passed directly to the ODBC driver string)Pooling=FalseTFDConnection.Connected := True to ensure the driver accepts the SSLMode parameter.To confirm that idle connections are being closed and not held by a hidden pool, run the following query on your PostgreSQL server while opening and closing the connection in your application:
SELECT count(*) FROM pg_stat_activity WHERE datname = 'your_db_name';
If Pooling=False is working as intended, the count should drop to zero immediately after TFDConnection.Close is called.
Diagnostic Detail Needed: Are you using a System DSN or a DSN-less connection string? If using a DSN, verify that the SSLMode is configured within the DSN setup itself, as some older DSN configurations may override parameters passed via FireDAC.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.