Sergii Zaskaleta
Sergii Zaskaleta

Reputation: 502

Connect to a Highly-Available SQL Server from R

We've recently upgraded to SQL Server 2012 which is Highly-Available DR enabled. When connecting using SSMS we need to specify MultiSubnetFailover=True additional connection option + increase timeouts.

How can we replicate this in R? Without this, we observe sporadic connectivity/timeout issues.
Related, but for Python

> packageVersion('RODBC')
[1] '1.3.6'
> packageVersion('Base')
[1] '2.15.2'

Upvotes: 1

Views: 204

Answers (1)

Benjamin
Benjamin

Reputation: 17359

If you are using a Data Source Name, you can add extra arguments to odbcConnect

odbcConnect(DSN, uid = "user_name", pwd = "password", MultiSubnetFailover = "True")

If you are using a connection string, you just need to add the arguments in your string.

odbcDriverConnect("driver=DRIVER; server=SERVER; database=DATABASE; uid=user_name; pwd=password; MultiSubnetFailover = True")

Upvotes: 1

Related Questions