dbDriver-methods: Oracle Implementation of the Database Interface (DBI) Classes...

Description Usage Arguments Details Value Side Effects References See Also Examples

Description

Oracle driver initialization and closing.

Usage

1
2
3
4
## S4 method for signature 'OraDriver'
dbUnloadDriver(drv, ...)
## S4 method for signature 'ExtDriver'
dbUnloadDriver(drv, ...)

Arguments

drv

An object that inherits from OraDriver or ExtDriver as created by dbDriver.

...

Any other arguments to pass to the driver drvName.

Details

dbDriver

This object is a singleton, that is, subsequent invocations of dbDriver return the same initialized object.

This implementation allows you to connect to multiple host servers and run multiple connections on each server simultaneously.

When interruptible is set to TRUE, it allows for interrupting long-running queries on the server by executing the query in a thread. Main thread checks for Ctrl-C and issues OCIBreak/OCIReset to cancel the operation on the server. By default, interruptible is FALSE.

When unicode_as_utf8 is set to FALSE, NCHAR, NVARCHAR and NCLOB data is fetched using the character set specified by the NLS_LANG setting. By default, unicode_as_utf8 is set to TRUE.

When ora.attributes is set to TRUE, the result set from dbGetQuery and fetch contains DBMS-specific attributes like ora.encoding, ora.type, and ora.maxlength for the corresponding column.

dbUnloadDriver

This implementation removes communication links between the R client and the database. It frees all connections and all result sets associated with those connection objects.

Value

dbDriver

An object OraDriver or ExtDriver whose class extends DBIDriver. This object is used to create connections, using the function dbConnect, to one or more Oracle Database engines.

dbUnloadDriver

Free all resources occupied by the driver object.

Side Effects

dbDriver

The R client part of the database communication is initialized, but note that connecting to the database engine needs to be done through calls to dbConnect.

dbUnloadDriver

Remove the communication link between the R client and the database.

References

For Oracle Database documentation, see http://www.oracle.com/technetwork/indexes/documentation/index.html.

See Also

Oracle, dbConnect, dbSendQuery, dbGetQuery, fetch, dbCommit, dbGetInfo, dbListTables, dbReadTable.

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
28
29
30
31
32
33
34
35
36
  ## Not run: 
    # first load the library
    library("ROracle")

    # create an Oracle instance
    drv <- dbDriver("Oracle")

    con <- dbConnect(drv, "scott", "tiger")
    dbListTables(con)

    # fetch all results from the emp table
    res <- dbGetQuery(con, "select * from emp")

    # dbSendQuery can be used to fetch data in chunks 
    # as well as all of data at once
    res <- dbSendQuery(con, "select * from emp")

    # fetch all results
    fetch(res)

    # or a chunk at a time
    fetch(res, n = 5)

    # describing the schema for the emp table using dbGetInfo
    dbGetInfo(res, what = 'fields')

    # clear the result
    dbClearResult(res)

    # disconnect from the database
    dbDisconnect(con)

    # free the driver object
    dbUnloadDriver(drv)
  
## End(Not run)

ROracle documentation built on Nov. 10, 2021, 5:08 p.m.