Apache Hive
Driver Options
Hadoop vendor - Download and install the driver made available by the Hadoop cluster provider (Cloudera, Hortonworks, etc.). To locate the driver please consult the vendor’s website.
Posit Professional Drivers - Workbench, RStudio Desktop Pro, Connect, or Shiny Server Pro users can download and use Posit Professional Drivers at no additional charge. These drivers include an ODBC connector for Apache Hive. Posit delivers standards-based, supported, professional ODBC drivers. Use Posit Professional Drivers when you run R or Shiny with your production systems. See the Posit Professional Drivers for more information.
Package Options
The odbc
package, in combination with a driver, provides DBI
support and an ODBC connection.
Connection Settings
There are six settings needed to make a connection:
- Driver - See the Drivers section for setup information
- Host - A network path to the database server
- Schema - The name of the schema
- UID - The user’s network ID or server local account
- PWD - The account’s password
- Port - Should be set to 10000
<- DBI::dbConnect(odbc::odbc(),
con Driver = "[your driver's name]",
Host = "[your server's path]",
Schema = "[your schema's name]",
UID = rstudioapi::askForPassword("Database user"),
PWD = rstudioapi::askForPassword("Database password"),
Port = 10000)
Known Issues
- It may be necessary to prevent Hive from returning the table prefix in column names. This can be done by setting
hive.resultset.use.unique.column.names
tofalse
when establishing a connection to Hive. See tidyverse/dbplyr#573 for more context.
<- DBI::dbConnect(odbc::odbc().
con
...,SSP_hive.resultset.use.unique.column.names = "false")