Error: F_JD20F2: DBMS Error [ODBC Driver 17 for SQL Server][SQL Server]
Issue
The following error appears:
Error: F_JD20F2: DBMS error [[ODBC Driver 17 for SQL Server][SQL Server] The target database ('<db_name>') is in an availability group and is currently accessible for connections when the application intent is set to read only. For more information about application intent, see SQL Server Books Online].
Environment
HVR 6
Resolution
To resolve this issue, first verify whether HVR should connect to the primary or secondary replica of the SQL Server Always On availability group.
If HVR should connect to the primary replica, update the SQL Server location or availability group routing configuration so that the connection reaches the primary replica.
If HVR should connect to the secondary replica, add an Environment action to the SQL Server location with the following parameters:
Cause
This issue occurs when HVR connects to a secondary availability replica configured to accept read-intent connections only, but the connection doesn't specify ApplicationIntent=ReadOnly.
SQL Server secondary replicas support the following connection access settings:
- No: User connections aren't allowed.
- Yes: All connections are allowed, but only for read access.
- Read-intent only: Only connections that specify read-only intent are allowed.
This issue may occur even if you didn't intend to connect to a secondary replica. For example, if the SQL Server location contains the address of a secondary replica or the replica roles changed after a failover.