-
Notifications
You must be signed in to change notification settings - Fork 93
Description
Hello,
I have used shinymanager authentication with sqllite database but since I wasn't persistence, I want to connect to SQL Server using .yml file.
Part of .yml file connection looks like this,
// # needed R packages for DB connection. Use comma separation for multiple dependencies like [package1, package2]
r_packages: [odbc]
// optional. Default to false = connect one time per session. True = connect/disconnect each request
connect_every_request: false
// connection usong DBI Interface
// Possible to use !expr Sys.getenv("NAME_ENV_VAR")
// all args to be passed to DBI::dbConnect by default
// use fun: "connect_function_name" to use other connected functinon
connect:
drv: !expr odbc::odbc()
Driver: "ODBC Driver 17 for SQL Server"
Server: "******"
Database: "******"
UID: "*****"
PWD: "*****"
port: 41433
Create SQL database
user <- data.frame(
user = c("admin", "curator", "user"),
password = c("pass0", "pass1", "pass2" ),
admin = c(T,F,F)
)
shinymanager::create_sql_db(
credentials_data = user,
config_path = "path/to/pg_template.yml"
)
Then using a minimal shiny app to login,
library(shiny)
library(shinymanager)
ui <- fluidPage(
tags$h2("My secure application"),
verbatimTextOutput("auth_output")
)
ui <- secure_app(ui, choose_language = TRUE)
server <- function(input, output, session) {
res_auth <- secure_server(
check_credentials = check_credentials(db = "path/to/pg_template.yml")
)
}
shinyApp(ui, server)
But I get this error when I try to login,
Listening on http://127.0.0.1:4567
Warning: Error in run_now: nanodbc/nanodbc.cpp:1783: 00000
[Microsoft][ODBC Driver 17 for SQL Server]String data, right truncation
70: <Anonymous>
69: stop
68: result_insert_dataframe [/tmp/Rtmpf9K93x/R.INSTALL3cd2513f1410/odbc/R/RcppExports.R#109]
65: .local [/tmp/Rtmpf9K93x/R.INSTALL3cd2513f1410/odbc/R/dbi-table.R#173]
64: dbAppendTable
62: write_sql_db
61: save_logs
60: ui
3: runApp [/tmp/Rtmp9eVnhH/R.INSTALL7cff42bb9f16/shiny/R/runapp.R#388]
2: print.shiny.appobj [/tmp/Rtmp9eVnhH/R.INSTALL7cff42bb9f16/shiny/R/shinyapp.R#565]
1: <Anonymous>
What could be the issue here? Thank you