agstudy / rsqlserver

Sql Server driver database interface (DBI) driver for R. This is a DBI-compliant Sql Server driver based on the System.Data.SqlClient.
82 stars 30 forks source link

Passing connection string between R and .NET is failing #45

Open ruaridhw opened 6 years ago

ruaridhw commented 6 years ago

Connection strings such as

are all valid for SQL Server however R requires that \ are escaped and .NET does not.

eg.

dbConnect("SqlServer", url = "Server=(local)\\SQL2014;...")

is a valid connection string in R.

This breaks when connections are passed as raw strings to .NET through SqlBulkWrite and SqlBulkCopy instead of connection objects.

Possible fix is to simply strip escaped backslashes prior to passing the connection string to .NET in dbBulkCopy and dbBulkWrite.