Learn R Programming

sqlhelper (version 0.2.1)

live_connection: Return the named connection or NULL

Description

Return the named connection or NULL

Usage

live_connection(conn_name)

Value

A live connection to a database, or NULL, invisibly, if conn_name is not the name of a live connection

Arguments

conn_name

Chr. The name of the live connection you want (use connection_info to get names of available connections).

Examples

Run this code
library(sqlhelper)
connect(
  system.file("examples/sqlhelper_db_conf.yml",
              package="sqlhelper")
)
connection_info()

conn <- live_connection("simple_sqlite")
conn

DBI::dbDisconnect(conn)
is.null(live_connection("simple_sqlite"))
is.null(live_connection("foo"))

Run the code above in your browser using DataLab