简体   繁体   中英

ubuntu to windows find file path r setwd

So I have an Access database that I am trying to see on a windows server 2008 R2 (server name: WrenLab02); this server has the network discovery on, has the folder shared with that title, and is able to be pinged from the ubuntu computer; however now I want to call the folder that the files are in (which I tested on the server itself and works), but on the Ubuntu it keeps saying file directory not found.

On the Ubuntu computer in R:

FilePath <- file.path("//WrenLab02/Clinical/")
if (file.exists(FilePath)) {
  setwd(FilePath)
} else {
  dir.create(file.path(FilePath))
  setwd(FilePath)
}

I know the path exists; I've tried it from another computer (which worked). Even I tried putting "smb://Wrenlab02/Clinical/" as the file director and still the setwd() cannot set the file path.

Maybe I just don't have the folder properly mapped to the Ubuntu, I tried to mount it and it is logged in and I can look at the files inside the folder and indeed the path says smb://WrenLab02/Clinical/ . So I don't know where to go from here.

I figured it out; if anyone else is trying to pull files from a windows machine and you are working on a Lynx or Unbuntu machine this code should help you out.

setwd("/run/user/1000/gvfs/smb-share:server=wrenlab02,share=clinical/")

However now I am trying to use odbcConnect from RODBC package; this will connect me to a database from another server

WrenLIS <- '/run/user/1000/gvfs/smb-share:server=wrenlab01,share=administration/DATABASE/CLINICAL DATABASE/PatientContactDB.accdb'
cns <- odbcConnect(dsn="WrenLIS", uid="nferranti", pwd="H0ckey")

but it wont connect I keep getting an error that says:

Warning messages:
1: In RODBC::odbcDriverConnect("DSN=WrenLIS;UID=nferranti;PWD=H0ckey") : [RODBC] ERROR: state IM002, code 0, message [unixODBC][Driver Manager]Data source name not found, and no default driver specified
2: In RODBC::odbcDriverConnect("DSN=WrenLIS;UID=nferranti;PWD=H0ckey") : ODBC connection failed

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM