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
This issue occurs when HVR can’t connect to the secondary node of a SQL Server Always On availability group cluster.
To resolve this issue, use the ApplicationIntent=ReadOnly
parameter when you connect to the availability group secondary replica instance. To do this in HVR, add a new action Environment to the SQL Server location with the following parameters:
Cause
While setting up read-only access on an availability replica, there are three connection access options:
- No: Secondary databases on this replica do not allow user connections and are inaccessible for reading. This is the default setting.
- Yes: All connections to secondary databases on this replica are permitted, but solely for reading purposes. All secondary databases are accessible for reading.
- Read-intent only: Only read-only connections are permitted to secondary databases on this replica. All secondary databases are accessible for reading.
If you configure a replica with the connection access setting read-intent only, the secondary replica only accepts connections configured explicitly for that purpose. Issues may occur when you attempt to connect to an availability group secondary replica database set to read-intent only without using the above parameter.