1

I'm having trouble finding the correct command to change databases in R-Studio. I know I can connect to a specific database at the initial connection but I can't seem to find the correct way to execute a "use" command (e.g. "use my_schema").

The following fail with various errors:

dbSendQuery(conn, "use my_schema");

dbExecute(conn, "use my_schema");

dbSendStatement(conn, "use my_schema");

I'm not finding what I'm looking for in the documentation here:

https://www.rdocumentation.org/packages/RJDBC/versions/0.2-8/topics/JDBCConnection-methods

https://www.progress.com/blogs/complete-guide-to-r-for-datadirect-odbc-jdbc

https://community.snowflake.com/s/article/Executing-use-commands-in-R-Studio

https://rdrr.io/cran/RJDBC/

Phil
  • 7,287
  • 3
  • 36
  • 66
John
  • 3,458
  • 4
  • 33
  • 54
  • Depending on the methods available to your specific driver class, you can use `conn@jc$setSchema("my_schema")`. – Wil Dec 28 '21 at 16:48

0 Answers0