Learn R Programming

ODB (version 1.2.1)

odb.open: Creates a connection to a .odb file

Description

Extracts embedded HSQLDB files from an .odb archive an sets a DBI connection to it, in order to read or write data from the database.

Usage

odb.open(odbFile, jarFile = NULL)

Arguments

odbFile

Path to the .odb file to connect to.

jarFile

Path to the .jar library of HSQLDB to use in JDBC. You should not have to care about it, as the current version is included in the package (used if NULL).

Value

An object of class "ODB", which will be used by every other functions of the package.

See Also

odb.close, odb.create

Examples

Run this code
# NOT RUN {
  # New empty .odb file
  odbFile <- tempfile(fileext=".odb")
  odb.create(odbFile, overwrite="do")
  odb <- odb.open(odbFile)
  
  # New table
  odb.write(odb, "CREATE TABLE fruits (name VARCHAR(6) PRIMARY KEY)")
  odb.insert(odb, "fruits", c("banana", "pear", "peach"))
  
  # Writes to the file and closes the connection
  odb.close(odb, write=TRUE)
# }

Run the code above in your browser using DataLab