I am trying to connect to the SQL server in python using pyodbc. I am unable to connect because my database is ReadOnly. I tried the solutions provided at other link:
import pyodbc
readonly_conn_str = "DRIVER={SQL Server};SERVER=...; DATABASE=...;readonly=True;"
conn = pyodbc.connect(readonly_conn_str)
But, I am still getting the following error:
ProgrammingError: ('42000', "[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]The target database ('PRMOperationalDB') 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. (978) (SQLDriverConnect); [42000] [Microsoft][ODBC SQL Server Driver]Invalid connection string attribute (0); [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]The target database ('PRMOperationalDB') 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. (978); [42000] [Microsoft][ODBC SQL Server Driver]Invalid connection string attribute (0)")
Any suggestions how to resolve this issue?