Last chance! 50% off unlimited learning
Sale ends in
Two connections are regarded as equal if and only if they have the same database name, host, DBMS, and port number.
conn.eql(conn.id1, conn.id2)
An integer, a connection ID number.
An integer, another connection ID number.
A logical. TRUE if and only if the two connections have the same database name, host, DBMS, and port number.
connection info
has all functions that can extract
information about the database connection.
db.connect
creates connections to the databases.
db.disconnect
disconnects an existing connection.
db.list
lists all the current connections with their
information.
# NOT RUN {
<!-- %% @test .port Database port number -->
<!-- %% @test .dbname Database name -->
## set up the database connection
## Assume that .port is port number and .dbname is the database name
cid1 <- db.connect(port = .port, dbname = .dbname, verbose = FALSE)
cid2 <- db.connect(port = .port, dbname = .dbname, verbose = FALSE)
db.list() # list the above two connections
conn.eql(cid1, cid2) # returns TRUE
db.disconnect(cid1, verbose = FALSE)
db.disconnect(cid2, verbose = FALSE)
# }
Run the code above in your browser using DataLab