dbConnect-methods {RMySQL}R Documentation

Create a connection object to an MySQL DBMS

Description

These methods are straight-forward implementations of the corresponding generic functions.

Methods

drv
an object of class MySQLDriver, or the character string "MySQL" or an MySQLConnection.
conn
an MySQLConnection object as produced by dbConnect.
username
string of the MySQL login name or NULL. If NULL or the empty string "", the current user is assumed.
password
string with the MySQL password or NULL. If NULL, only entries in the user table for the users that have a blank (empty) password field are checked for a match.
dbname
string with the database name or NULL. If NOT NULL, the connection sets the default database to this value.
host
string identifying the host machine running the MySQL server or NULL. If NULL or the string "localhost", a connection to the local host is assumed.
unix.socket
(optional) string of the unix socket or named pipe.
port
(optional) integer of the TCP/IP default port.
client.flag
(optional) integer setting various MySQL client flags. See the MySQL manual for details.
group
string identifying a section in the default.file to use for setting authentication parameters (see MySQL.)
default.file
string of the filename with MySQL client options. Defaults to \$HOME/.my.cnf
...
Currently unused.

Side Effects

A connection between R/S-Plus and an MySQL server is established. The current implementation supports up to 100 simultaneous connections.

References

See the Database Interface definition document DBI.pdf in the base directory of this package or http://stat.bell-labs.com/RS-DBI.

See Also

MySQL, dbConnect, dbSendQuery, dbGetQuery, fetch, dbCommit, dbGetInfo, dbReadTable.

Examples

## Not run: 
# create an MySQL instance and create one connection.
drv <- dbDriver("MySQL")

# open the connection using user, passsword, etc., as
con <- dbConnect(drv, group = "rs-dbi")

# Run an SQL statement by creating first a resultSet object
rs <- dbSendQuery(con, statement = paste(
                      "SELECT w.laser_id, w.wavelength, p.cut_off",
                      "FROM WL w, PURGE P", 
                      "WHERE w.laser_id = p.laser_id", 
                      "SORT BY w.laser_id")
# we now fetch records from the resultSet into a data.frame
data <- fetch(rs, n = -1)   # extract all rows
dim(data)
## End(Not run)

[Package RMySQL version 0.7-4 Index]