bmaitner / RBIEN

Tools for accessing the Botanical Information and Ecology Network (BIEN) database
http://bien.nceas.ucsb.edu/bien/
Other
41 stars 10 forks source link

Return error message if connection is being blocked #5

Open bmaitner opened 6 years ago

bmaitner commented 6 years ago

It would be useful to have the internal function BIEN_sql return a specific and easily understood error message if the package cannot connect to the database.

wcornwell commented 6 years ago

Cool package! was just trying to explore a bit and I got this error message:

> BIEN_plot_country(c("Costa Rica","Panama"))
Error in postgresqlNewConnection(drv, ...) : 
  RS-DBI driver: (could not connect public_bien@vegbiendev.nceas.ucsb.edu:5432 on dbname "public_vegbien": could not connect to server: Connection refused
    Is the server running on host "vegbiendev.nceas.ucsb.edu" (128.111.84.31) and accepting
    TCP/IP connections on port 5432?
)

Any idea if the database connection issue is specific to me? firewall of some kind? I can access http://vegbiendev.nceas.ucsb.edu/

R version 3.4.2 (2017-09-28)

other attached packages:
[1] BIEN_1.2.2        RPostgreSQL_0.6-2 DBI_0.7   
mcgregorian1 commented 5 years ago

I discovered the package today and tried this as well. vignette("BIEN") states

Database connection issues

Some institution and computer programs (e.g. some antivirus programs) block the SQL connections that this package relies on. While we are exploring ways around this issue, at present the simplest method is to use the package on a computer/network that doesn’t block SQL connections.