connect_to_epd: Conect to a EPD database

Description Usage Arguments Details Value Examples

View source: R/EDPr-DDBB_connection.R

Description

connect_to_epd establish a connection to a EPD data base that is stored in a DDBB server. By default it assume a local PostgreSQL server. The function can connect with remote servers in different formats (MySQL, etc.; see RPostgreSQL documentation for supported formats). To connect to the DDBB the function need the DDBB name, the user name, and the user password. If any of the data are not passed as arguments the function will ask for them interactively.

Usage

1
2
connect_to_epd(database = NULL, user = NULL, password = NULL,
  driver = "PostgreSQL", host = "localhost", ...)

Arguments

database

character Character string with the DDBB name. If not provided the function will ask for it before establishing the connection.

user

character Character string with the user name. A valid user in the DDBB server. If not provided the function will ask for it before establishing the connection.

password

character Character string with the user password. A valid password for the user in the DDBB server. If not provided the function will ask for it before establishing the connection.

driver

character Character string with the driver used to connect with the DDBB server (default: "PostgreSQL"). This value will depend on the DDBB server used to host the EPD database. Look at the dbConnect-methods function for alternatives.

host

character Character string with the IP address of the DDBB server (default: "localhost").

...

Other arguments to dbConnect-methods.

Details

A companion vignette is provided in the package to explain how to set up the EPD in a PostgreSQL server.

Value

This function returns a RPostgreSQL connection object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
epd.connection <- connect_to_epd()
epd.connection <- connect_to_epd(database="epd", user="epdr",
                                password="epdrpw", host="localhost")
epd.connection
# To list all the tables in the database we have connected with
dbListTables(epd.connection)
Query data from the connection with a SQL statement
dbGetQuery(epd.connection, "SELECT e_ FROM synevent;")
disconnect_from_epd(connection=epd.connection)

## End(Not run)

dinilu/EPDr documentation built on Aug. 22, 2019, 1:03 p.m.