# 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 two connections
conn.eql(cid1, cid2) # returns TRUE
## use the example data to create a table in connection 1
delete("abalone", conn.id = cid2)
x <- as.db.data.frame(abalone, "abalone", conn.id = cid1, verbose = FALSE)
db.disconnect(cid1) # disconnect connection 1
## lookat(x) # gives an error since connection 1 is disconnected
conn.id(x) <- cid2 # 1 and 2 are the same
lk(x) # gives what you want
db.disconnect(cid2, verbose = FALSE)
# }
Run the code above in your browser using DataLab