How to specify a SQL DB in RStudio?

Hi all,

Please forgive me if this is a very simple task, but I am struggling to execute it. I will try to explain it as best I can.

I have successfully connected RStudio to a SQL Server via an odbc connection.

Once connected, all the databases within that server are visable on the right side. I only want to work with one particular DB at the moment, but I'm unsure as to how to reference it in R Studio.

I am completely new to R and am learning via the internet (so it's a nightmare tbh haha)

Any help you could give me would be greatly appriciated.

Thanks in advance.

Miki

Have you read the Getting Started material here?
https://db.rstudio.com/getting-started/connect-to-database/

If you follow the instructions here, I think it has you setting up in such a way that you're connecting to a specific database, rather than to the entire server, e.g.:

con <- dbConnect(odbc(), 
                 Driver = "SQL Server", 
                 Server = "localhost\\SQLEXPRESS", 
                 Database = "datawarehouse", 
                 Trusted_Connection = "True")
1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.