Created
August 11, 2016 14:33
-
-
Save alitrack/931e0eb83d06f12e86ea803549086ca0 to your computer and use it in GitHub Desktop.
PostgreSQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(readxl, quietly=TRUE) | |
df <- read_excel("d:/my.xlsx",col_names = TRUE) | |
library(RPostgreSQL) | |
drv <- dbDriver("PostgreSQL") | |
con <- dbConnect(drv, user='postgres', password='', dbname='alitrack', host='postgres.alitrack.com') | |
postgresqlpqExec(con, "SET client_encoding = 'GBK'") | |
dbWriteTable(con, c("my_schema","my_table"), data.frame(df), row.names = FALSE) | |
# Free up resources | |
dbDisconnect(con) | |
dbUnloadDriver(drv) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment