Create connection with the MySQL compendium database

Description

Allows the user to create a connection with the compendium database in the MySQL server

Usage

1
connectDatabase(user, password, host = "localhost", dbname = "compendium", port = 3306)

Arguments

user

character string defining the MySQL user name to login to the database

password

character string defining the password required to connect to the MySQL database

host

character string defining the host name. The default value is "localhost". One can also connect to a remote server by defining a valid value for the host name, e.g., "machinename.\domain.\org".

dbname

character string defining the name of the compendium database to which one wants to establish a connection. The default value is "compendium".

port

port number used to connect to the MySQL server. The default port number is 3306.

Details

The compendium database has to be created first, see the package vignette for how to do this from the MySQL prompt.

Value

A list with components

connect

a component of class MySQLConnection containing the connection to the MySQL database

user

character string containing the user name

password

character string containing the password

host

character string containing the host name

port

port number used to connect to the MySQL server

dbname

character string containing the database name

Note

Do not check the returned value of this function, since this might abort the current R session. summary(conn) can be used to check the returned list.

Author(s)

Umesh K. Nandal

Examples

1
2
3
4
5
 ## Not run: 
  # Connect to a database with name "compendium"
  conn <- connectDatabase(user="usrname",password="passwd",host="localhost",dbname="compendium")
 
## End(Not run)