R: No applicable method for 'tbl' error when making a SQL Server query using dplyr and pool

Apologies if this has been answered elsewhere, but I could not find it. With the following code I am connecting to an MS SQL database using the RJDBC mechanism using pooling from the pool package:


drv <-
    "C:/R/RJDBC/Microsoft JDBC Driver 6.0 for SQL Server/sqljdbc_6.0/enu/jre8/sqljdbc42.jar"

pool_instance <- dbPool(
  drv = drv,
  dbname = "dbasename",
  url = "jdbc:sqlserver://sql01",
  user = "user",
  password = "password"

mydata <- dbGetQuery(pool_instance, "select * from my.Table")
src_pool(pool_instance) %>% tbl("my.Table") %>% head(5)

When I run this code, I make a successful connection to my SQL Server database and the dbGetQuery function call retrieves the data as expected.

  • How to drop tables based on sys.objects?
  • How to write an ADODB.RecordSet (made from an Excel Range) to a SQL Server temporary table
  • How to pass sql function parameter by value
  • Get every combination of sort order and value of a csv
  • User Stored Proc Returns NULL--underlying query works as planned
  • Ruby on Rails working with SQL variables in c#
  • However, when I call the src_pool function I get the following error message:

    Error in UseMethod(“tbl”) : no applicable method for ‘tbl’ applied
    to an object of class “c(‘src_’, ‘src_sql’, ‘src’)”

    If I call the function src_pool(pool_instance) separately, without piping to the tbl function, the error message is similar:

    Error in UseMethod(“src_desc”) : no applicable method for
    ‘src_desc’ applied to an object of class “c(‘src_’, ‘src_sql’, ‘src’)”

    I expected that either dplyr or pool would provide for these methods? Do I need to write code for these methods? What am I missing?

    Note that I am a newby to SQL Server database connectivity.

  • How to create SQL Server table from dplyr pipeline
  • MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.