Search code examples
sqlr

i m getting Error in h(simpleError(msg, call))


I m getting error in evaluating the argument 'drv' in selecting a method for function 'dbConnect': argument "x" is missing, with no default

library(DBI)
library(RSQL)
library(dplyr)
con <- dbConnect(SQL(), "/Users/serges/Downloads/MAMA.bak")

Solution

  • Specify Driver You need to explicitly specify the database driver you want to use. Since you're working with a .bak file (likely a SQL Server backup file), you'll probably need the odbc driver.

    Install the RODBC package if you haven't already:

    install.packages("RODBC")
    

    Connect to the Database: example:

       library(DBI)
       library(RSQL)
       library(dplyr)
       library(RODBC) 
    
       con <- dbConnect(odbc::odbc(), 
                 Driver = "SQL Server", 
                 Server = "your_server_name", 
                 Database = "your_database_name", 
                 UID = "your_username", 
                 PWD = "your_password")