Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does ApplicationIntent=ReadOnly mean in the connection string

I am using MS Access to connect to Sql Server through a DSN connection. This is a linked table to a sql server backend. Here is the connection string

ODBC;DSN=mydsn;Description=mydesc;Trusted_Connection=Yes;APP=Microsoft Office 2010;DATABASE=mydb;ApplicationIntent=READONLY;;TABLE=dbo.mytable 

As you can see there is a ApplicationIntent=READONLY tag in the connection string. What does this mean. Am I connecting to the database in a read only fashion? Is it recommended to perform updates and inserts using this connection string?

like image 406
Luke101 Avatar asked Mar 11 '13 20:03

Luke101


People also ask

What is read-only routing URL?

Read-only routing refers to the ability of SQL Server to route qualifying read-only connection requests to an available Always On readable secondary replica (that is, a replica that is configured to allow read-only workloads when running under the secondary role).

What is read intent only in Alwayson?

Read intent only: This setting allows Read-Only workloads when running as a secondary role only if the application connection string contains the parameter: Application Intent = Read-Only.

What is MultiSubnetFailover true?

When MultiSubnetFailover=True is specified for a connection, the client retries TCP connection attempts faster than the operating system's default TCP retransmit intervals. This enables faster reconnection after failover of either an AG or FCI, and is applicable to both single- and multi-subnet AGs and FCIs.


Video Answer


1 Answers

This means that if you are using Availability Groups in SQL Server 2012, the engine knows that your connections are read only and can be routed to read-only replicas (if they exist). Some information here:

Configure Read-Only Access on an Availability Replica

Availability Group Listeners, Client Connectivity, and Application Failover

If you are not currently using Availability Groups, it may be a good idea to leave that in there for forward compatibility, but it really depends on whether or not you are intentionally only just reading. This should prevent writes but there are some caveats. These Connect items may be useful or may leave you scratching your head. I'll confess I haven't read them through.

ApplicationIntent=ReadOnly allows updates to a database

ApplicationIntent=ReadOnly does not send the connection to the secondary copy

like image 116
Aaron Bertrand Avatar answered Sep 22 '22 06:09

Aaron Bertrand