I'm trying to connect to AWS Athena using Simba Athena ODBC in r.
DBI::dbConnect(
odbc::odbc(),
driver = "Simba Athena ODBC Driver",
S3OutputLocation = <>,
AwsRegion = "us-east-2",
AuthenticationType = "IAM Credentials",
Schema = <>,
AWS_ACCESS_KEY_ID = <>,
AWS_SECRET_ACCESS_KEY = <>)
Error: nanodbc/nanodbc.cpp:1021: 00000: [Simba][ODBC] (11560) Unable to locate SQLGetPrivateProfileString function: [Simba][DSI] An error occurred while attempting to retrieve the error message for key 'LibsLoadErr' with message parameters ['""'] and component ID 3: Message not found in file "/Library/simba/athenaodbc/ErrorMessages/en-US/ODBCMessages.xml"
I've updated my ODBC driver to route to the correct file per this question - Simba Athena ODBC: unable to use SQLGetPrivateProfileString functions
I am also getting a response from the odbc:odbcListDrivers() function:
name attribute value
ODBC Drivers Simba Athena ODBC Driver Installed
Simba Athena ODBC Driver Description. Simba Athena ODBC Driver
Simba Athena ODBC Driver Driver. /Library/simba/athenaodbc/lib/libathenaodbc_sb64.dylib
Related
I am trying to work on R notebook on ML Studio. Using regular python is easy and works as expected but with R i am facing challenges.
While trying to connect to MS SQL database using odbc() :
library(odbc)
con <- dbConnect(odbc(),
Driver = "SQL Server",
Server = "server",
Database = "db",
UID = "user",
PWD = "password",
Port = 1433)
Error: nanodbc/nanodbc.cpp:1021: 00000: [unixODBC][Driver Manager]Can't open lib 'SQL Server' : file not found
As suggested in some posts, i have also tried replacing Driver = "SQL Server", with Driver = "ODBC Driver 11 for SQL Server". But i see similar error
Error: nanodbc/nanodbc.cpp:1021: 00000: [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 11 for SQL Server' : file not found
Traceback:
Please suggest a work around.
We can assign the Driver as the version of the SQL server and get the password using the API call.
library(odbc)
con <- DBI::dbConnect(odbc::odbc(),
Driver = "ODBC Driver 13 for SQL Server",
Server = "your server IP address",
Database = "Database name",
UID = "User ID",
PWD = rstudioapi::askForPassword("password"),
Port = port_number_under_user)
In some cases, Driver = "SQL Server” will also work fine. If not functioning. Use the above code block.
I am using both the DBI and ODBC package in "R" in order to make a connection to an ORACLE database.
Here is the connection code I am using:
library(DBI)
library(odbc)
con <- DBI::dbConnect(odbc::odbc(),
Driver = "ORACLE",
Host = "orasada.ca",
SVC = "STG",
UID = "username",
PWD = "password",
Port = 1521)
Everything looks fine to me, but I keep getting this error:
Error: nanodbc/nanodbc.cpp:983: IM002: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Any ideas on what I can change to make a successful connection?
Thanks.
I'm trying to connect to a mongoDB database using library(odbc) in R. First I installed the driver from here and then I have used the following method:
con <- dbConnect(odbc::odbc(),
Driver = "MongoDB ODBC 1.3.0 Unicode Driver",
Server = "xxxxx",
AuthMechanism = "SCRAM-SHA-1",
Port = 27017,
Database = "test",
UID = "utest",
PWD = "ptest"
)
However the following error will happen:
Error: nanodbc/nanodbc.cpp:983: 08S01: [MySQL][ODBC 1.3(w) Driver]Lost
connection to MySQL server at 'waiting for initial communication
packet', system error: 10060
I would appreciate any help.Thanks
I'm trying to connect R to a remote SQL Server based on this. I use
library(DBI)
conn <- dbConnect(
drv = RMySQL::MySQL(),
dbname = "td",
host = "hmsales.cav7mnk7ifa9.us-west-2.rds.amazonaws.com",
username = "trades",
password = "u#6MS06")
but the connection is not working.Failed to connect to database: Error: Can't connect to MySQL server on 'hmsales.cav7mnk7ifa9.us-west-2.rds.amazonaws.com' (0) What do I miss? Note that I do not give the real credentials here. Then I want to connect with a table named "rep_user_listings".
After installing `ODBC Driver 11 for SQL Server I have also used :
library(DBI)
conn <- dbConnect(
drv = odbc::odbc(),
driver = "ODBC Driver 11 for SQL Server",
database = "td",
server = "hmsales.cav7mnk7ifa9.us-west-2.rds.amazonaws.com",
uid = "trade",
pwd = "u#6MS06X")
and I get:
Error: nanodbc/nanodbc.cpp:950: 08001: [Microsoft][ODBC Driver 11 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53].
and
library(RODBC)
dbconnection <- odbcDriverConnect("Driver=ODBC Driver 11 for SQL Server;Server=hmsales.cav7mnk7ifa9.us-west-2.rds.amazonaws.com\\SQLEXPRESS; Database=tdsh;Uid=trade; Pwd=u#6MS06Xv; trusted_connection=yes")
initdata <- sqlQuery(dbconnection,paste("select * from rep_user_listings;"))
odbcClose(dbconnection)
and I get:
Warning messages:
1: In odbcDriverConnect("Driver=ODBC Driver 11 for SQL Server;Server=hmsales.cav7mnk7ifa9.us-west-2.rds.amazonaws.com\\SQLEXPRESS; Database=tdsh;Uid=tradeshow; Pwd=u#6MS06Xvdoy; trusted_connection=yes") :
[RODBC] ERROR: state 08001, code -1, message [Microsoft][ODBC Driver 11 for SQL Server]SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF].
2: In odbcDriverConnect("Driver=ODBC Driver 11 for SQL Server;Server=hmsales.cav7mnk7ifa9.us-west-2.rds.amazonaws.com\\SQLEXPRESS; Database=tdsh;Uid=tradeshow; Pwd=u#6MS06Xvdoy; trusted_connection=yes") :
[RODBC] ERROR: state HYT00, code 0, message [Microsoft][ODBC Driver 11 for SQL Server]Login timeout expired
3: In odbcDriverConnect("Driver=ODBC Driver 11 for SQL Server;Server=hmsales.cav7mnk7ifa9.us-west-2.rds.amazonaws.com\\SQLEXPRESS; Database=tdsh;Uid=tradeshow; Pwd=u#6MS06Xvdoy; trusted_connection=yes") :
[RODBC] ERROR: state 08001, code -1, message [Microsoft][ODBC Driver 11 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.
4: In odbcDriverConnect("Driver=ODBC Driver 11 for SQL Server;Server=hmsales.cav7mnk7ifa9.us-west-2.rds.amazonaws.com\\SQLEXPRESS; Database=tdsh;Uid=tradeshow; Pwd=u#6MS06Xvdoy; trusted_connection=yes") :
ODBC connection failed
There isn't a native SQL Server client in development for R, the most recent I'm aware of (https://github.com/imanuelcostigan/RSQLServer) is archived/deprecated in lieu of the odbc package.
Try this:
library(DBI)
conn <- dbConnect(
drv = odbc::odbc(),
driver = "ODBC Driver 17 for SQL Server",
database = "td",
server = "hmsales.cav7mnk7ifa9.us-west-2.rds.amazonaws.com",
uid = "trades",
pwd = "u#6MS06")
(And if that works, immediately change your password. :-)
I chose "ODBC Driver 17 for SQL Server" because I previously installed the mssql driver for my windows and linux machines (current version available here), and found the driver "name" here:
unique(odbc::odbcListDrivers()$name)
# [1] "SQL Server" "PostgreSQL ANSI(x64)"
# [3] "PostgreSQL Unicode(x64)" "SQLite3 ODBC Driver"
# [5] "ODBC Driver 17 for SQL Server"
If you have an older version installed (such as 11 or 13) or something else, use that driver instead (or upgrade).
Firstly, don't give out your credentials online. Based on what i am looking at, open your terminal and ping your server to make sure you have network access to your server.
If you are using Linux one of the known issues is dont use domain name use ipaddess if you have also, make trusted connection =no.
I am trying to connect to Teradata database from R terminal using code below,
"> con <- DBI::dbConnect(odbc::odbc(),
+ Driver = "Teradata",
+ Host = "xxxx",
+ DBCName = "xxxx",
+ UID = "xxxx"
+ )"
I have created /etc/odbc.ini and /etc/odbcinst.ini and below are the contents of the same,
odbc.ini:
[ODBC]
InstallDir=/opt/teradata/client/16.20/odbc_64
DataEncryption='ON'
[ngmtdd01]
Driver=/opt/teradata/client/16.20/odbc_64/lib/tdataodbc_sb64.so
Description=Teradata Dev
DBCName=xxxx.dev.uk.capitalone.com
LoginTimeout=120
odbcinst.ini
[ODBC DRIVERS]
Teradata Database ODBC Driver 16.20=Installed
[Teradata Database ODBC Driver 16.20]
Driver=/opt/teradata/client/16.20/odbc_64/lib/tdataodbc_sb64.so
APILevel=CORE
ConnectFunctions=YYY
DriverODBCVer=3.51
SQLLevel=1
I expected to get connected to the teradata cli but I am getting below error.
Error: nanodbc/nanodbc.cpp:950: IM002: [DataDirect][ODBC lib] Data source name not found and no default driver specified"
You defined a DSN but your connection string is "DSN-less" (using Driver= not DSN=) and Driver= specifies the wrong driver name; the actual name is Teradata Database ODBC Driver 16.20
Note that Teradata also supplies a Teradata SQL Driver for R package that does not require ODBC.