Oracle driver initialization and closing.
1 2 3 4
An object that inherits from
Any other arguments to pass to the driver
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.
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.
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.
ora.attributes is set to TRUE, the result set from
fetch contains DBMS-specific attributes like
ora.maxlength for the
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.
Free all resources occupied by the driver object.
The R client part of the database communication is initialized,
but note that connecting to the database engine needs to be done through
Remove the communication link between the R client and the database.
For Oracle Database documentation, see http://www.oracle.com/technetwork/indexes/documentation/index.html.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.