open_dsn_channel_sqls_odbc: Open an ODBC channel to a SQL Server database

View source: R/open-dsn-channel.R

open_dsn_channel_sqls_odbcR Documentation

Open an ODBC channel to a SQL Server database

Description

Creates & opens a channel and checks its important characteristics.

Usage

open_dsn_channel_sqls_odbc(
  dsn_name,
  driver_version_minimum = numeric_version("17.0"),
  driver_version_maximum = numeric_version("99.0")
)

Arguments

dsn_name

Name of the locally-defined DSN passed to DBI::dbConnect().

driver_version_minimum

The driver must be at least this version number. Represented as a base::numeric_version()

driver_version_maximum

The driver must not exceed this version number. Represented as a base::numeric_version()

Details

A DSN channel requires more code than usual to diagnose problems, because the DSN is defined on the local computer, and is not under the control of the repository. This function wraps the basic DBI::dbConnect(odbc::odbc(), dsn = dsn_name) function with some checks. If unsuccessful, it returns some hints how to correct the problem, such as downloading the newest version from the Microsoft website.

OuhscMunge::open_dsn_channel_sqls() was deprecated and was removed 2020-10-18. Please use 'OuhscMunge::open_dsn_channel_sqls_odbc().

Note

Assuring a minimum version is important, because driver versions can interpret values differently. For example, earlier version (before 11.0) returned dates as characters, which would propagate undetected through our code until it broke something with an unhelpful error message.

Examples

## Not run: 
requireNamespace("OuhscMunge")

OuhscMunge::open_dsn_channel_sqls_odbc(
  dsn_name        = "miechv_eval"
)

## End(Not run)

OuhscBbmc/OuhscMunge documentation built on Nov. 5, 2024, 1:05 p.m.