R doesn't see odbc.ini files

I’m trying to run a Shiny app with external PostgreSQL connection. When I do it with hardcoded data like below, it works, but when I want to move to use DSN and etc/odbc.ini file it doesn’t and I got an error (Error: nanodbc/nanodbc.cpp:1021: 00000: could not connect to server: No such file or directory). Both files odbc/odbcinst are configured properly. I think there is some missing connection path to that file from R session, but I’m not sure. Any hints what to check?

I’ve added (ADD odbc.ini /etc/odbc.ini) on my Docker file as well


dbicon ← DBI::dbConnect(
driver = “PostgreSQL Driver”,
database = “mydb”,
server = “server”,
port = “port”,
uid = “uid”,
pwd = “pwd”)

Doesn’t work

dbicon ← DBI::dbConnect(odbc::odbc(), “PostgreSQL”)

Did you add the file path to the shiny app? Here is how I add the www folder to my app:

shiny::addResourcePath(prefix, directoryPath)

Hey, do we need to add resource path for system .ini files? I was sure that system detects them automatically, even I run odbcListDataSources or objects I can see a driver and db. Anyway will check that, thanks