| JDBCConnection-methods {RJDBC} | R Documentation |
Methods for the class ‘JDBCConnect’ in Package ‘RJDBC’
Description
Methods for the class ‘JDBCConnection’ in Package ‘RJDBC’.
dbSendQuery and dbSendUpdate submit a SQL query to the
database. The difference between the two is only that
dbSendUpdate is used with DBML queries and thus doesn't return
any result set.
dbGetTables and dbGetFields are similar to
dbListTables and dbListFields but the result is a data
frame with all available details (whereas the latter return only a
character vector of the names).
Usage
dbSendUpdate (conn, statement, ...)
dbGetTables (conn, ...)
dbGetFields (conn, ...)
Arguments
conn |
connection object |
statement |
SQL statement to execute |
... |
additional arguments to prepared statement substituted for "?" |
Details
Some notable enhancements to the DBI API:
dbSendUpdate supports vectorized arguments which is far more
efficient than using scalar updates. Example:
dbSendUpdate(c, "INSERT INTO myTable VALUES(?, ?)", rnorm(1000), runif(1000))
performs a single JDBC batchExecute() call. Additional
parameter max.batch=10000L is an integer that specifies the
maximum batch size supported by the DBMS.
dbSendQuery and dbSendUpdate accept both ...
(populated frist) as well as list= (populated as second).
Only unnamed arguments are used from ... (assuming that those
are function arguments and no data) while all elements are used from
list=.
dbGetQuery is a shorthand for sendQuery +
fetch. Parameters n=-1, block=2048L and
use.label=TRUE are passed through to fetch() others to
dbSendQuery.
dbListTables and dbGetTables have the arguments
(conn, pattern="%", schema=NULL). dbExistsTable is just
a wrapper for dbGetTables.
dbWriteTable is defined as
(conn, name, value, overwrite=FALSE, append=FALSE, force=FALSE, ..., max.batch=10000L)
and is just a short-hand for the corresponding dbSendUpdate()
statements. Since it is only a convenience wrapper, it is strongly
recommended to use dbSendUpdate() in any real use-cases
as you have far more control over the shape and properties of the
table if you issue the CREATE TABLE statement according to
your DBMS' capabilities.
dbReadTable is just a shorthand for
dbGetQuery(c, "SELECT * from <table>")
Methods
- dbBegin
signature(conn = "JDBCConnection", ...)- dbCommit
signature(conn = "JDBCConnection", ...)- dbDataType
signature(dbObj = "JDBCConnection", obj = "ANY", ...)- dbDisconnect
signature(conn = "JDBCConnection", ...)- dbExistsTable
signature(conn = "JDBCConnection", name = "character", ...)- dbGetException
signature(conn = "JDBCConnection", ...)- dbGetFields
signature(conn = "JDBCConnection", ...)- dbGetInfo
signature(conn = "JDBCConnection", ...)- dbGetQuery
signature(conn = "JDBCConnection", statement = "character", ...)- dbGetTables
signature(conn = "JDBCConnection", ...)- dbListFields
signature(conn = "JDBCConnection", ...)- dbListResults
signature(conn = "JDBCConnection", ...)- dbListTables
signature(conn = "JDBCConnection", ...)- dbReadTable
signature(conn = "JDBCConnection", ...)- dbRemoveTable
signature(conn = "JDBCConnection", ...)- dbRollback
signature(conn = "JDBCConnection", ...)- dbSendQuery
signature(conn = "JDBCConnection", statement = "character", ...)- dbSendUpdate
signature(conn = "JDBCConnection", statement = "character", ...)- dbWriteTable
signature(conn = "JDBCConnection", ...)