Skip to contents

Connect to a SciDB database

Usage

scidbconnect(
  host = getOption("scidb.default_shim_host", "127.0.0.1"),
  port = getOption("scidb.default_shim_port", 8080L),
  username = NULL,
  password = NULL,
  auth_type = c("scidb", "digest"),
  protocol = c("http", "https"),
  admin = FALSE,
  int64 = FALSE,
  doc
)

Arguments

host

optional host name or I.P. address of a SciDB shim service to connect to

port

optional port number of a SciDB shim service to connect to. For connecting to Shim when the Shim port is forwarded, use port= NULL (see detailed note below).

username

optional authentication username

password

optional authentication password

auth_type

optional SciDB authentication type

protocol

optional shim protocol type

admin

Set to TRUE to open a higher-priority session. This is identical with the --admin flag for the iquery SciDB client (default FALSE)

int64

logical value, if TRUE then preserve signed 64-bit SciDB integers as R integer64 values from the bit64 package. Otherwise, 64-bit integers from SciDB are converted to R double values, possibly losing precision.

doc

optional AFL operator/macro documentation (see notes)

Value

A scidb connection object. Use $ to access AFL operators and macros, ls() on the returned object to list SciDB arrays, and names() on the returned object to list all available AFL operators and macros.

Note

Use the optional username and password arguments with auth_type set to "digest" to use HTTP digest authentication (see the shim documentation to configure this). Digest authentication may use either "http" or "https" selected by the protocol setting. Set auth_type = "scidb" to use SciDB authentication, which only works over "https".

Use the returned SciDB connection object (of class afl) with other package functions to interact with SciDB arrays. Apply R's ls function on the returned value to see a list of arrays. The returned value contains a list of available SciDB AFL language operators and macro names. Use the dollar-sign function to accesss those functions.

The optional doc argument may be a three-column data frame with character-valued columns name, signature, and help containing AFL operator names, function signatures, and help strings, respectively. See `data("operators", package="scidb")` for an example.

Forwarded Shim port: Shim usually runs on a selected port e.g. 8080 or 8083 (for secure communication) and those ports need to be opened up to clients. In other situations, the admin might decide to not open the Shim port and instead forward the Shim port to a URL like https://hostname/shim/. In this case, we do not need to supply the port number during scidbconnect(); instead one should use port = NULL and host=HOSTNAME/FORWARDED-PATH/.

All arguments support partial matching.

See also

Examples

if (FALSE) { # \dontrun{
db <- scidbconnect()

# SciDB 15.12 authentication example (using shim's default HTTPS port 8083)
db <- scidbconnect(user="root", password="Paradigm4",
                   auth_type="scidb", port=8083, protocol="https")

# List available AFL operators
names(db)

# List arrays
ls(db)

# Explicitly upload an R matrix to SciDB:
x <- as.scidb(db, matrix(rnorm(20), 5))
# Implicitly do the same as part of an AFL expression
y <- db$join(x,  as.scidb(matrix(1:20, 5)))
print(y)

as.R(y)   # Download a SciDB array to R.
} # }