Skip to content

Query timeout option (SQL_ATTR_QUERY_TIMEOUT) #515

Open
@Odraio

Description

@Odraio

Issue Description and Expected Result

Previously the RODBCext package provided an option to set the query timeout. As of 2020 the package is deprecated and the better alternative is odbc (cran).

This odbc package doesn't seem to provide the described option. I was wondering if there is another way around to implement a query timeout while using odbc (perhaps something like the C code of the RODBCext package which sets the value of SQL_ATTR_QUERY_TIMEOUT).

(R does have a withTimeout function, but I want to have a reliable/ correct implementation)

The nanodbc.cpp file does have a timeout function which sets the required SQL_ATTR_QUERY_TIMEOUT attribute, but this doesn't seem to be available in the R code?

Database

Microsoft SQL Server

Reproducible Example

con <- dbConnect(
odbc::odbc(),
driver = "SQL Server",
server = "SERVERNAME",
trusted_connection = TRUE,
timeout = 5,
encoding = "Latin1")

samplequery <- dbGetQuery(con, "
SELECT * FROM [Something]
")

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions