I've the error ORA - 12560 when I try connect to Oracle DB installed on VM.
sql*plus, pl/sql, excel - connect successfully
Сonnection code in R
con <- dbConnect(odbc::odbc(), driver ='Oracle in instantclient_19_14',
dns = "user", encoding = "windows-1251",PWD ="qazedcwsx")
#--- output Error: nanodbc/nanodbc.cpp:1021: IM006: [Oracle][ODBC][Ora]ORA-12560: TNS:protocol adapter error
sql*plus I can connect only if after the password I write #sid, in R same method not working
Help please =(
Connected ! =)
con <- dbConnect(odbc::odbc(),
.connection_string = "Driver={Oracle in nstantclient_19_14};Dbq=XE;Uid=user;Pwd=qazedcwsx;)
Related
A colleague at work is having trouble using the odbc package function. I am trying to find help.
He is using an oracle database using R instead of running our traditional SAS programs, but he has not been successful. We are trying to find out what is causing the error messages below. Can someone help?
Attempt 1:
#Get the Oracle JDBC driver
jdbcDriver =JDBC("oracle.jdbc.OracleDriver",
classPath="C:/instantclient_19_10/ojdbc8.jar")
Create connection string to the Database we want
connect.string <-
glue("jdbc:oracle:thin:#//{host}:{port}/{sid}",
host = "stdbprd01.states.bls.gov",
port = 1521,
sid = "lausonep")
print(connect.string)
#Establish connection to your database
con <- dbConnect(jdbcDriver,
connect.string,
user = "username",
password = rstudioapi::askForPassword("Database password"))
Error in .jcall(drv#jdrv, "Ljava/sql/Connection;", "connect", as.character(url)[1], :
java.sql.SQLRecoverableException: Listener refused the connection with the following error:
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
Attempt 2:
library(odbc)
con <- DBI::dbConnect(odbc::odbc(),
driver="Oracle in OraClient12Home1",
database="lausprd",
uid="aakre_n",
pwd="!QAZ1qaz#WSX2wsx",
host="stdbprd01.states.bls.gov",
port=1521
)
Error: nanodbc/nanodbc.cpp:1021: IM006: [Oracle][ODBC][ORA]-12560: TNS:protocol adapter error
[Microsoft][ODBC Driver Manager] Driver’s SQLSetConnectAttr failed
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 build a r shiny app which uses the odbc library to fetch the data from server hosted in public server and shows the result output. It is working perfectly under Win10.
I am using the below code to connect to server:
library(odbc)
con <- dbConnect(odbc(),
Driver = "SQL Server Native Client 11.0",
Server = "****",
Database = "****",
UID = "****",
PWD = "****")
When I hosted the app in www.shinyapps.io it is not working. It shows the error as below:
Warning: Error in : nanodbc/nanodbc.cpp:950: 01000: [unixODBC][Driver Manager]Can't open lib 'SQL Server Native Client 11.0' : file not found
I am unable to why it says 'file not found'? The app works perfectly when I run the app using rstudio from my PC.
Please help.
Thanks in advance.
Sumanta
You have to use FreeTDS. I found either using 7.4 or 7.0 version.
try this using odbc:
library(DBI)
library(odbc)
con <- dbConnect(
odbc(),
Driver = "FreeTDS",
Database = database,
Uid = uid,
Pwd = pwd,
Server = server,
Port = 1433,
TDS_Version = 7.4
)
or this usind rodbc:
library(RODBC)
con <- odbcDriverConnect(
'Driver=FreeTDS;
TDS_Version=7.4;
Server=<server>;
Port=<port>;
Database=<db>;
Uid=<uid>;
Pwd=<pw>;
Encrypt=yes;
TrustServerCertificate=no;
Connection Timeout=30;')
I'm trying to use
odbcDriverConnect("driver={SQL
Server};server=IP;database=DBNAME;uid=username;pwd=password")
to connecting sql server database from shiny R,
but its result is -1.
I run the same code in R studio and get results normally, what's the problem?
For testing more I tried this one:
con <- dbConnect(odbc::odbc(),
Driver = "SQL Server",
Server = "IP",
Database = "dbname",
UID = "username",
PWD ="password",
Port = Port)
But again it runs in R studio but not in shiny and gets this error:
nanodbc/nanodbc.cpp:950: IM002: [unixODBC][Driver Manager]Data source name
not found, and no default driver specified