conn.id {PivotalR} | R Documentation

## Find out the connection ID of a `db.obj` object

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

    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

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

[Package PivotalR version 0.1.18.3.1 Index]