odbc
odbc copied to clipboard
How to connect to Oracle DB without using TNS
Issue Description and Expected Result
This is a very simple question, I've Oracle Instant Client installed, and could connect to my DB with Data Source, but I want to connect it just likes SQL Server (provide UID:PWD@IP:Port in the code/config).
I tried example in https://db.rstudio.com/databases/oracle/#connection-settings but it could not work and output an IM006 error (IM006: [Oracle][ODBC][Ora]ORA-12560: TNS:protocol adapter error).
So anyone here could provide a working example? I've all params needed to connect (host, port, service name/sid, uid, pwd, etc.)
Database
Oracle Database 19c
Session Info
devtools::session_info()
#> ─ Session info ─────────────────────────────────────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.2.1 (2022-06-23 ucrt)
#> os Windows 10 x64 (build 25179)
#> system x86_64, mingw32
#> ui RStudio
#> language en
#> collate Chinese (Simplified)_China.utf8
#> ctype Chinese (Simplified)_China.utf8
#> tz Asia/Taipei
#> date 2022-08-17
#> rstudio 2022.07.1+554 Spotted Wakerobin (desktop)
#> pandoc 2.19 @ D:\\Scoop\\shims\\pandoc.exe
#>
#>─ Packages ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> DBI 1.1.3.9000 2022-06-18 [1] https://r-dbi.r-universe.dev (R 4.2.0)
#> devtools 2.4.3.9000 2022-05-06 [1] https://r-lib.r-universe.dev (R 4.2.0)
#> odbc 1.3.3.9000 2022-07-01 [1] https://r-dbi.r-universe.dev (R 4.2.1)