JDBCConnection-methods | R Documentation |
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).
dbSendUpdate (conn, statement, ...) dbGetTables (conn, ...) dbGetFields (conn, ...)
conn |
connection object |
statement |
SQL statement to execute |
... |
additional arguments to prepared statement substituted for "?" |
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>")
signature(conn = "JDBCConnection", ...)
signature(conn = "JDBCConnection", ...)
signature(dbObj = "JDBCConnection", obj =
"ANY", ...)
signature(conn = "JDBCConnection", ...)
signature(conn = "JDBCConnection", name =
"character", ...)
signature(conn = "JDBCConnection", ...)
signature(conn = "JDBCConnection", ...)
signature(conn = "JDBCConnection", ...)
signature(conn = "JDBCConnection", statement
= "character", ...)
signature(conn = "JDBCConnection", ...)
signature(conn = "JDBCConnection", ...)
signature(conn = "JDBCConnection", ...)
signature(conn = "JDBCConnection", ...)
signature(conn = "JDBCConnection", ...)
signature(conn = "JDBCConnection", ...)
signature(conn = "JDBCConnection", ...)
signature(conn = "JDBCConnection",
statement = "character", ...)
signature(conn = "JDBCConnection",
statement = "character", ...)
signature(conn = "JDBCConnection", ...)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.