New to ODBC in R (RStudio), and getting a failed to connect error?
In Windows (unsure of other OSes) you need to go into the ODBC Data Source Administrator, and add the data source. The ODBC Data Source Administrator is accessed via the 'Administrative Tools' section of Control Panel (in Windows 10 at least).
The connection command is then simply
conn <- odbcConnect("QV Training")
ODBC Connection using R
Following is the one needed to solve the issue.
dbhandle_dev = odbcDriverConnect('driver={ODBC Driver 17 for SQL Server};server="DevSQL01";database="risk";trusted_connection=Yes')
How to access SQL Server database hosted on Azure Windows VM using R from Rstudio Connect hosted on AWS ubuntu server?
At last this worked for me:
library(odbc)
library(DBI)
UserId <- 'mycompany\rkahn'
UserPassword <- 'myPassword'
dbname <- 'sqldb'
sqlsrvcon <- dbConnect(odbc(),
Driver = "/opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.0.so.1.1",
Server = "azure_wvm_name.corp.mycompany.com",
Database = dbname,
UID = UserId,
PWD = UserPassword,
Encrypt="yes",
TrustServerCertificate="yes",
Port = 1433)
Related Topics
Converting Numeric Time to Datetime Posixct Format in R
Update Shiny's 'Selectinput' Dropdown with New Values After Uploading New Data Using Fileinput
How to Convert Dd/Mm/Yy to Yyyy-Mm-Dd in R
Convert Integer as "20160119" to Different Columns of "Day" "Year" "Month"
Remove Space Between Bars Ggplot2
How to Get a Second Bibliography
Strange Formatting of Legend in Ggplotly in R
Submit Form with No Submit Button in Rvest
Ggplot2, Geom_Bar, Dodge, Order of Bars
Shiny Renderui Selectinput Returned Null
Read Observations in Fixed Width Files Spanning Multiple Lines in R
Calculate Percentage of Each Category in Each Group in R
How to Scrape/Automatically Download PDF Files from a Document Search Web Interface in R
How to Filter Data Without Losing Na Rows Using Dplyr