-
Notifications
You must be signed in to change notification settings - Fork 0
/
db_connection.R
33 lines (26 loc) · 1.2 KB
/
db_connection.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#DBs:
library(RODBC)
library(RMariaDB)
library(RPostgres)
##### Connections to different databases -----
credentials <- readRDS('C:/Users/Artur.Dossatayev/Documents/credentials/cred.RDS')
mssql <- odbcDriverConnect(paste0('driver={SQL Server};server=',
credentials$mssql$local,
';database=',
credentials$mssql$db,
';uid=',
credentials$mssql$login,
';pwd=',
credentials$mssql$password,
';'))
redshift <- dbConnect(RPostgres::Postgres(),
host=credentials$redshift$server,
port=credentials$redshift$port,
user=credentials$redshift$login,
dbname=credentials$redshift$db,
password=credentials$redshift$password)
mysql <- dbConnect(MariaDB() ,user=mysql$mysql$login,
port = credentials$mysql$port,
host=credentials$mysql$server,
dbname=credentials$mysql$db,
password=credentials$mysql$password)