Skip to contents

Connecting and disconnecting

Connecting to and disconnecting from databases.

dbConnect()
Create a connection to a DBMS
dbDisconnect()
Disconnect (close) a connection
dbCanConnect()
Check if a connection to a DBMS can be established
dbGetInfo()
Get DBMS metadata
dbIsValid()
Is this DBMS object still valid?
dbIsReadOnly()
Is this DBMS object read only?
DBIConnector-class
DBIConnector class
dbGetConnectArgs()
Get connection arguments

Tables

Reading and writing entire tables.

dbReadTable()
Read database tables as data frames
dbWriteTable()
Copy data frames to database tables
dbCreateTable()
Create a table in the database
dbAppendTable()
Insert rows into a table
dbRemoveTable()
Remove a table from the database
dbListTables()
List remote tables
dbListFields()
List field names of a remote table
dbExistsTable()
Does a table exist?
dbListObjects()
List remote objects
sqlRownamesToColumn() sqlColumnToRownames()
Convert row names back and forth between columns

Queries and statements

Communicate with the DBMS.

dbGetQuery()
Retrieve results from a query
dbExecute()
Change database state

Results

More control for sending queries and executing statements.

dbSendQuery()
Execute a query on a given database connection
dbSendStatement()
Execute a data manipulation statement on a given database connection
dbBind() dbBindArrow()
Bind values to a parameterized/prepared statement
dbFetch() fetch()
Fetch records from a previously executed query
dbGetRowCount()
The number of rows fetched so far
dbGetRowsAffected()
The number of rows affected
dbGetStatement()
Get the statement associated with a result set
dbHasCompleted()
Completion status
dbColumnInfo()
Information about result types
dbClearResult()
Clear a result set

Transactions

Ensuring multiple statements are executed together, or not at all.

dbBegin() dbCommit() dbRollback()
Begin/commit/rollback SQL transactions
dbWithTransaction() dbBreak()
Self-contained SQL transactions

SQL

Tools for creating and parsing SQL queries.

SQL()
SQL quoting
dbDataType()
Determine the SQL data type of an object
dbQuoteIdentifier()
Quote identifiers
dbQuoteLiteral()
Quote literal values
dbQuoteString()
Quote literal strings
sqlCreateTable()
Compose query to create a simple table
sqlAppendTable() sqlAppendTableTemplate()
Compose query to insert rows into a table
sqlData()
Convert a data frame into form suitable for upload to an SQL database
dbUnquoteIdentifier()
Unquote identifiers
sqlInterpolate()
Safely interpolate values into an SQL string

Arrow

Experimental lifecycle

Returning and sending data in the Arrow format.

dbReadTableArrow()
Read database tables as Arrow objects
dbWriteTableArrow()
Copy Arrow objects to database tables
dbCreateTableArrow()
Create a table in the database based on an Arrow object
dbAppendTableArrow()
Insert rows into a table from an Arrow stream
dbGetQueryArrow()
Retrieve results from a query as an Arrow object
dbSendQueryArrow()
Execute a query on a given database connection for retrieval via Arrow
dbBind() dbBindArrow()
Bind values to a parameterized/prepared statement
dbFetchArrow()
Fetch records from a previously executed query as an Arrow object
dbFetchArrowChunk()
Fetch the next batch of records from a previously executed query as an Arrow object

Classes

S4 classes defined by DBI.

DBI DBI-package
DBI: R Database Interface
DBIObject-class
DBIObject class
DBIDriver-class
DBIDriver class
DBIConnection-class
DBIConnection class
DBIResult-class
DBIResult class
DBIResultArrow-class DBIResultArrowDefault-class
DBIResultArrow class
DBIConnector-class
DBIConnector class
Id()
Refer to a table nested in a hierarchy (e.g. within a schema)

Data

S4 classes defined by DBI.

.SQL92Keywords
Keywords according to the SQL-92 standard