Cannot acess to a local database via R - r

I am trying to access to a database HWSD.md which can be downloaded here : http://webarchive.iiasa.ac.at/Research/LUC/External-World-soil-database/HTML/HWSD_Data.html?sb=4
I have a linux machine and I tried this command line but I have a message error
require(MonetDB.R)
Mydb <- src_monetdb("*/HWSD.mdb")
Error in socketConnection(host = host, port = port, blocking = TRUE, open = "r+b", :
cannot open the connection
In addition: Warning message:
In socketConnection(host = host, port = port, blocking = TRUE, open = "r+b", :
localhost:50000 cannot be opened
Anyone can help me out with it?

Related

How do I open a vpn in R to eventually connect to a SQL database

cmd <- unname(Sys.which("rasdial"))
cmd_args <- c('"VPN Name"', "user","password")
system2(command = cmd, args = cmd_args)
When I run the above it gives me the error:
sh: 1: : Permission denied
Warning message:
In system2(command = cmd, args = cmd_args) : error in running command
I am trying to do this with openvpn. Any help would be much appreciated.

Error when using mailR package on Ubuntu machine

I have the following code:
text <- 'sample'
sender <- "***"
recipients <- c("***")
send.mail(from = sender,
to = recipients,
subject = text,
body = text,
smtp = list(host.name = "smtp.gmail.com", port = 465,
user.name = "***",
passwd = "***", ssl = TRUE),
authenticate = TRUE,
send = TRUE)
The text variable is in my case a value that is fetched from a database but this makes it easier. The code above works fine when I run it on my local machine. However when I run it on Linux Ubuntu the exact same code gives me the following error:
org.apache.commons.mail.EmailException: Sending the email to the following
server failed : smtp.gmail.com:465
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1410)
at org.apache.commons.mail.Email.send(Email.java:1437)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl. java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:43)
Can anybody tell me what could be the reason that I get this error on Linux enviroment (and not when I run it local)?

R: change port to connect with SFTP server

I have a connection with an ftp server with the following code:
url <- "ftp://MyServer"
userpwd <- "MyUser:MyPass"
filenames <- getURL(url, userpwd = userpwd, ftp.use.epsv = FALSE, dirlistonly = TRUE, port = 22)
filen <- "MyFile.csv"
rawdata <- getURL(paste(url, filen, sep = ""), userpwd = userpwd, crlf = TRUE)
The file will be moved to an SFTP server, so I need to change the input. This new SFTP server is accessed via port 22 instead of the standard port 21. At the moment the connection fails with the following error
Error in function (type, msg, asError = TRUE) :
Failed to connect to MyServer port 21: Connection refused
It takes the wrong port, but how do I tell R to choose port 22?
You need to specify the SFTP protocol in the URL, so the line
url <- "ftp://MyServer"
should become
url <- "sftp://MyServer"
getUrl will then use the SSH port (22).

R: Ryacas package not working properly on Mac

I can't get the Ryacas package to work on Mac. I keep getting this error:
[1] "Starting Yacas!"
In> Error in socketConnection(host = "127.0.0.1", port = 9734, server = FALSE, : cannot open the connection
In addition: Warning message:
In socketConnection(host = "127.0.0.1", port = 9734, server = FALSE, : 127.0.0.1:9734 cannot be opened
Any help would be greatly appreciated.

tnsping resolves but not able to connect using script

I am not able to connect to an oracle database from my R/Python scripts. Following is the code. TNSPing utility is able to resolve the database using LDAP. I am pasting TNSPING output as well.
TNSPing output
C:\Windows\System32>tnsping UHK00500_SECCOMPAS_APPL
TNS Ping Utility for 32-bit Windows: Version 11.2.0.2.0 - Production on 12-APR-2
013 10:26:26
Copyright (c) 1997, 2010, Oracle. All rights reserved.
Used parameter files:
c:\apps\oracle\network\admin\sqlnet.ora
Used LDAP adapter to resolve the alias
Attempting to contact (DESCRIPTION = (SDU = 8192) (TDU = 8192) (ADDRESS_LIST = (
ADDRESS = (PROTOCOL = TCP)(HOST = PHKLOD2002-SCAN.ap.hedani.net)(PORT = 1522)) (
LOAD_BALANCE = on) (FAILOVER = on ) ) (CONNECT_DATA = (SERVICE_NAME = UHK00500_S
ECCOMPAS_APPL.WORLD) (FAILOVER_MODE = (TYPE = session) (METHOD = basic) (RETRIES
= 20) (DELAY = 5))))
OK (60 msec)
R script output
Oracle 11g driver
chan <- odbcDriverConnect("driver=Oracle in OraHome112_32;DBQ=UHK00500_SECCOMPAS_APPL;UID=toolkit;PWD=**")
Warning messages:
1: In odbcDriverConnect("driver=Oracle in OraHome112_32;DBQ=UHK00500_SECCOMPAS_APPL;UID=toolkit;PWD=**") :
[RODBC] ERROR: state 08004, code 12154, message [Oracle][ODBC][Ora]ORA-12154: TNS:could not resolve the connect identifier specified
2: In odbcDriverConnect("driver=Oracle in OraHome112_32;DBQ=UHK00500_SECCOMPAS_APPL;UID=toolkit;PWD=**") :
ODBC connection failed
ODBC driver output
chan <- odbcDriverConnect("Driver={Microsoft ODBC for Oracle};Server=UHK00500_SECCOMPAS_APPL;Uid=toolkit;Pwd=**")
Warning messages:
1: In odbcDriverConnect("Driver={Microsoft ODBC for Oracle};Server=UHK00500_SECCOMPAS_APPL;Uid=toolkit;Pwd=*") :
[RODBC] ERROR: state 08001, code 12154, message [Microsoft][ODBC driver for Oracle][Oracle]ORA-12154: TNS:could not resolve the connect identifier specified
2: In odbcDriverConnect("Driver={Microsoft ODBC for Oracle};Server=UHK00500_SECCOMPAS_APPL;Uid=toolkit;Pwd=**") :
ODBC connection failed
Can someone please advice what i should check here to correct this issue?
not sure what the issue was, but after restarted my R instance the connection was fine.

Resources