Fatal Error with RODBC in RStudio, not R - Operation time out error

Split from: Fatal Error with RODBC in RStudio, not R (Session Aborted)

Just set up a connection on my Macbook at work, and it works in terminal fine but within RStudio I get an "Operation timed out" error.

Extra information would be helpful. Can you give me details as to what you're trying to do when you get this error?

Also system info can be helpful, see below

Some system Information could be useful as well

#### System Information:
- RStudio Edition: (Desktop or Server)
- RStudio Version: 
- OS Version: 
- R Version: 

#### Also:
<!-- Depending on your issue, the following may be useful /-->
<!-- If a section isn't relevant or you can't collect it just delete that section below /-->
- RStudio diagnostics report: <!--see rstd.io/support-diagnostics-report /-->
- Your `sessionInfo()`:
- RStudio crash report: <!-- rstd.io/support-crash-report /-->
- RStudio application log files: <!-- rstd.io/support-ide-log-files /-->


I have a similar but not exactly the same issue.

I am running Rstudio on EC2. RODBC works in R (shell), but not in Rstudio. I ran the commands below in Rstudio:

ch = odbcConnect('BDP3_Hive')

and got the following error message:
1: In RODBC::odbcDriverConnect("DSN=BDP3_Hive") :
  [RODBC] ERROR: state 08001, code 10380, message [Cloudera][ODBC] (10380) Unable to establish a connection with data source. Missing settings: {[Host] [Port]}
2: In RODBC::odbcDriverConnect("DSN=BDP3_Hive") : ODBC connection failed

Rstudio Edition: Desktop
Rstudio Version: 0.99.489
OS Version: RHEL Server 7.4
R version: 3.4.3

I'd love to provide other relevant information if you tell me how to obtain them.

@Jin Where did you configure host and port on your environment ? they should be somewhere if this is working with R shell.

Also, have you considered using odbc :package: instead of RODBC. At work, we use this method describe on db.rstudio.com using DSN configuration file.

@cderv The configure file is in /.odbc.ini It clearly has the Host and Port information. It is just for some reason Rstudio doesn't pick it up.

I did some search and found the following post:

It seems that it has something to do with /usr/lib64/R/etc/ldpaths, and I am asking my sys admin to take a look. Is this something you can confirm (that ldpaths has to be edited)?

I am using odbc package on my local laptop, and I just need to work with our sys admin to understand how to use odbc package on EC2...

I do not recall having to modify this.
You can check that odbc.ini is correctly found with odbcListDataSources() and odbcListDrivers from odbc :package:

You'll see what is picked up on your system.

Can you try?

@cderv I installed odbc package and ran the two commands you recommended. It seems that the odbc.ini is not correctly registered, but I am not so sure as I am a newbie.

Is there anyway we can take this discussion off-line? I don't want to share potentially sensitive information in a public forum...


By default, the user file should be ~/.odbc.ini, as explained in the location chapter. There is also sytem wide file somewhere. You should respect the way of writing them. See the doc. There is also an env var mentioned that could change the default path. If you have followed the installation process explained i.e brew install unixodbc, this should work and odbcListDataSources should give you the DSN name that are picked by odbc.

You can send me a private message if you really need, but I have no macOS and i don't think that your private information will help.

I would:

  1. (Re)check the unixodbc installation
  2. (Re)check that you have installed the correct driver
  3. (Re)check the odbc configuration
  4. (Re)check the db informations.

Also, I recall some topic in this forum about odbc and MacOS. Have you search through old and resolved topics already ?

Hi Cderv.

we have hosted the rstuido on one of ec2 and we have installed unix odbc, cloudera odbc drivers already .yes the .odbc.ini file is created under jin's profile .with same settings of .odbc.ini its working for other users for soem reason its not working for jin and one more user.

it is really strange if this is working for other. I am not sure I can do more as I don't have any more ressource to point you toward. You need to redo step by step and check if the environment is the same for all the user.