1

On an ubuntu based pc, I'm trying to use dplyr to explore datasets at my workplaces MS databases. So installed odbc and the drivers necessary and ran the following script:

library("odbc")
library("tidyverse")
con <- dbConnect(odbc(),
                 Driver="ODBC Driver 17 for SQL Server",
                 Server ="123.123.123.123",
                 Database = "database_name",
                 UID = "user_id",
                 PWD = rstudioapi::askForPassword("Database password"),
                 Port = 1433)

However, I get the following error:

Error: nanodbc/nanodbc.cpp:1021: 00000: [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: Error code 0x2746  [Microsoft][ODBC Driver 17 for SQL Server]Client unable to establish connection  [Microsoft][ODBC Driver 17 for SQL Server]Invalid connection string attribute 

Thing is, I have been able to access another restricted database at my workplace no problem and I have also been able to access this one no problem on different sql clients on the same machine no problem. I'd appreciate any sort of input on the same. Thanks in advance.

  • Welcome to SO Dys_unemployed ! When you say `I have been able to access another restricted database` do you mean a restricted MS SQL database on the same server ? If not you could try to test connectivity to this server with ping command from a terminal : `ping 123.123.123.123` – cbo Jun 28 '21 at 08:40
  • From the error message, I'd guess something is misnamed or missing in the dbConnect arguments. You might find this website useful for determining what is required for the connection string: https://www.connectionstrings.com/microsoft-odbc-driver-17-for-sql-server/ and this question for the 0x2746 Error code: https://stackoverflow.com/q/57265913/7742981 – Simon.S.A. Jun 29 '21 at 03:41

0 Answers0