R: Custom Function to Reconnect to Databases in your Scripts

# reconnect() ####
reconnect<-function(){
  # Just replace my ODBC names with yours
  # You can also use non-ODBC connections
  require(RODBC)
  try(odbcClose(db), silent = TRUE)
  db <-odbcConnect("SomeDB")
  sqlQuery(db,"use Jason")
  db1 <- odbcConnect("AnotherDB")
  db2 <- odbcConnect("YetAnotherDB")
}