For a given database connection, these functions return the user name, host, database name, info about database management system, connection, the version of MADlib installed on this database, the schema name of MADlib installation, and the R package that is used to connect to this database.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Default value is 1. The database connection ID number
user, a string, which is the user name.
host, a string, which is the host address.
dbname, a string, which is the database name.
dbms, a string, which is DBMS version information.
conn, an object of DBI connection, which can be directly
used with packages such as RPostgreSQL.
port, an integer, which is the port number of the connection.
madlib, a string, which is the MADlib version information.
madlib.version, a string, exactly the same as
schema.madlib, a string, which is the schema name of MADlib
conn.pkg, a string, which is the name of the R package that
has been used to connect to this database.
Author: Predictive Analytics Team at Pivotal Inc.
Maintainer: Frank McQuillan, Pivotal Inc. firstname.lastname@example.org
db.connect creates connections to the databases.
db.disconnect disconnects an existing connection.
db.list lists all the current connections with their
conn.eql tests whether two connections are actually the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
## Not run: ## set up the database connection ## Assume that .port is port number and .dbname is the database name cid1 <- db.connect(port = .port, dbname = .dbname, verbose = FALSE) cid2 <- db.connect(port = .port, dbname = .dbname, verbose = FALSE) user(cid1) host(cid2) dbname(cid1) # use default connection 1 dbms(cid1) madlib(cid1) madlib.version(cid1) schema.madlib(cid1) conn.pkg(cid1) ## conn is mostly for other packages con <- conn(cid1) # get the connection object dbListTables(con) # directly use functions in package RPostgreSQL ## This package provides a better function to list all tables/views db.objects(cid1) # list all tables/views with their schema in connection 1 db.disconnect(cid1, verbose = FALSE) db.disconnect(cid2, verbose = FALSE) ## End(Not run)