## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----eval=FALSE---------------------------------------------------------------
# library(odbc.resourcer)
# res <- resourcer::newResource(url = "odbc+mssql://localhost:1433/EpidemiologyDB/PatientData", identity = "sa", secret = "YourStrong@Password123")
# # Create a resource client
# client <- resourcer::newResourceClient(res)

## ----eval=FALSE---------------------------------------------------------------
# df <- client$asDataFrame()

## ----eval=FALSE---------------------------------------------------------------
# client$close()

## ----eval=FALSE---------------------------------------------------------------
# library(odbc)
# library(DBI)
# 
# # Connect using odbc package
# conn <- DBI::dbConnect(odbc::odbc(),
#                   Driver = "ODBC Driver 18 for SQL Server",
#                   Server = "localhost,1433",
#                   Database = "EpidemiologyDB",
#                   UID = "sa",  # Use 'sa' instead of 'myuser'
#                   PWD = "YourStrong@Password123",  # Use the SA password from docker-compose
#                   TrustServerCertificate = "yes")
# 
# # Test the connection
# DBI::dbGetQuery(conn, "SELECT TOP 5 * FROM PatientData")
# # Disconnect
# DBI::dbDisconnect(conn)

