\name{asp.dbConnect} \alias{asp.dbDisconnect} \alias{asp.dbConnect} \alias{asp.con} \alias{asp.showConnection} \alias{asp.lastCall} \title{ Create a connection between Asp and MySQL database containing StatShop run data. } \description{ The \code{asp.dbConnect} function creates a connection between Asp and a MySQL database containing the output from a StatShop run. The \code{asp.dbDisconnect} function closes the database connection if it is still open. This is done automatically when R exits. The \code{asp.showConnection} function shows the last command used to open a connection. } \usage{ asp.dbConnect(database, user, host="localhost", password="", driver=MySQL(force.reload=FALSE), ...) asp.dbDisconnect() asp.showConnection() } \arguments{ \item{database}{String giving the name of the database containing the StatShop output.} \item{user}{String giving the user name of a user who has access to that output; often your NT login id.} \item{host}{Machine name for machine which contains the database.} \item{password}{Password if needed for connection.} \item{driver}{A DBIConnection object, defaults to using a RMySQL driver.} \item{...}{Further arguments which are passed to \code{dbConnect}; not needed for MySQL connections, but reserved for future use.} } \details{ The connection is mantained in a global variable called \code{asp.con} which is used as part of many of the other Asp function. This function is basically a wrapper for the \code{dbConnect} function in the DBI package. A global variable \code{asp.lastCall} is use to record the last call to \code{asp.dbConnect}. It is set to \code{NULL} by \code{asp.dbDisconnect}. } \section{Side Effects}{ A connection between R/S-Plus and an MySQL server is established. The current implementation supports up to 100 simultaneous connections. Sets the value of the global variable \code{asp.con} which maintains the connection. If this connection closes, the \code{asp.dbConnect} function may need to be called again. Sets the value of the global variable \code{asp.lastCall} which tracks the last call used to open/close the database. } \references{ See the Database Interface definition document \code{DBI.pdf} in the base directory of this package or \url{http://stat.bell-labs.com/RS-DBI}. } \seealso{ \code{\link{MySQL}},\code{\link{daCapo}}, \code{\link[DBI]{dbConnect}},\code{\link{listModels}}, \code{\link{getChains}}, \code{\link{getCycles}}, \code{\link{getAllParameters}}, \code{\link{getVariable}}, \code{\link{asp.debugQueries}} } \examples{\dontrun{ ## connect to a local database. asp.dbConnect("mcmc_statistics_test","ralmond") ## connect to a remote database asp.dbConnect("mcmc_statistics_test","junit",host="comet.research.ets.org") ## Close when finished asp.dbDisconnect() } } \keyword{database}