Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 R 中的 ROracle 包连接到 oracle 数据库。使用下面的代码块,我建立了到 oracle DB 的连接。
drv <- dbDriver("Oracle") con <- dbConnect(drv, user=UName, password=Pword, dbname = Dbname )
我可以使用以下命令关闭连接
dbDisconnect(con)
为了确保在发生错误时正确关闭连接,我想知道连接的状态。就像它已经关闭或仍然打开一样。
我执行以下操作:
drv <- ROracle::Oracle() sapply(ROracle::dbListConnections(drv), ROracle::dbDisconnect)