Set Read-Only Access for Crystal Report in AlwaysOn

I have two SQL servers that balance the load - AlwaysOn. It is estimated that only the second of these servers will be used for crystal reporting. I would like to access the second SQL server using the readOnly flag in the connection string: ApplicationIntent=ReadOnly

In my C # class, I run crystal reports based on ConnectionInfo()

 var myConnectionInfo = new ConnectionInfo(); Tables myTables = reportDocument.Database.Tables; for (int i = 0; i < myTables.Count; i++) { var myTable = myTables[i]; var myTableLogonInfo = myTable.LogOnInfo; myConnectionInfo.ServerName = 'serverName'; myConnectionInfo.DatabaseName = 'databaseName'; myConnectionInfo.UserID = 'userId'; myConnectionInfo.Password = 'password'; myTableLogonInfo.ConnectionInfo = myConnectionInfo; myTable.ApplyLogOnInfo(myTableLogonInfo); } 

I did not find a way to set ApplicationIntent=ReadOnly . Should this be done setting myConnectionInfo.Attributes ? Unfortunately, I did not find the answer to this question, but did not answer:

+5
source share
2 answers

Unfortunately, I did not find a way to use the flag ApplicationIntent=ReadOnly in my published code snippet.

What I finished doing:
Instead of using the load balancing IP address (or host name), I directly use the report server IP address. I could not find any written documentation of whether ApplicationIntent=ReadOnly can be used.

+1
source

Instead of using ConnectionInfo, you can use System.Data.SqlClient.SqlConnectionStringBuilder, which has a custom ApplicationIntent property.

0
source

Source: https://habr.com/ru/post/1270240/


All Articles