conn.id: Find out the connection ID of a 'db.obj' object

Description Usage Arguments Value Author(s) See Also Examples

Description

Each db.obj object contains the ID of the connection that its data resides on. This function returns the connection ID number. The user can also change the connection ID that a db.obj is associated with.

Usage

1
2
conn.id(x)
conn.id(x) <- value

Arguments

x

A db.obj object.

value

An integer, the connection ID number. The user is allowed to change the connection ID that is associated with x.

Value

An integer, the connection ID associated with x

Author(s)

Author: Predictive Analytics Team at Pivotal Inc.

Maintainer: Frank McQuillan, Pivotal Inc. fmcquillan@pivotal.io

See Also

db.connect creates connections to the databases.

db.disconnect disconnects an existing connection.

db.list lists all the current connections with their information.

connection info has all functions that can extract information about the database connection.

conn.eql tests whether two connections are actually the same one.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## Not run: 


## 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)

## End(Not run)

PivotalR documentation built on March 13, 2021, 1:06 a.m.