dbConnect-methods            package:DBI            R Documentation

_C_r_e_a_t_e _a _c_o_n_n_e_c_t_i_o_n _t_o _a _D_B_M_S

_D_e_s_c_r_i_p_t_i_o_n:

     Connect to a DBMS going through the appropriate authorization
     procedure.

_U_s_a_g_e:

       dbConnect(drv, ...)
       dbDisconnect(conn, ...)

_A_r_g_u_m_e_n_t_s:

     drv: an object that inherits from 'DBIDriver', a character string
          specifying the DBMS driver, e.g., "RPgSQL",  "ROracle",
          "Informix", "RSQLite", or possibly another 'dbConnect'
          object. 

    conn: a  connection object as produced by 'dbConnect'. 

    ... : authorization arguments needed by the DBMS instance; these
          typically include 'user', 'password', 'dbname', 'host',
          'port', etc.  For details see the appropriate 'DBIDriver'. 

_D_e_t_a_i_l_s:

     Some implementations  may allow you to have multiple connections 
     open, so you may invoke this function repeatedly assigning its 
     output to different objects.

     The authorization mechanism is left unspecified, so check the 
     documentation of individual drivers for details.

_V_a_l_u_e:

     An object that extends 'DBIConnection' in a database-specific
     manner.  For instance 'dbConnect("MySQL")' produces an object of
     class 'MySQLConnection'. This object is used to direct commands to
     the database engine.

     'dbDisconnect' returns a logical value indicating whether the
     operation succeeded or not.

_S_i_d_e _E_f_f_e_c_t_s:

     A connection between R/S-Plus and the database server is
     established, and the R/S-Plus program becomes a client of the
     database engine. Typically the connections is through the TCP/IP
     protocol,  but this will depend on vendor-specific details.

_R_e_f_e_r_e_n_c_e_s:

     See the Database Interface definition document 'DBI.pdf' in the
     base directory of this package or <URL:
     http://developer.r-project.org/db>.

_S_e_e _A_l_s_o:

     'dbConnect' 'dbSendQuery' 'dbGetQuery' 'fetch' 'dbCommit'
     'dbGetInfo' 'dbReadTable'

_E_x_a_m_p_l_e_s:

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

     # open the connection using user, passsword, etc., as
     con <- dbConnect(drv, "user/password@dbname")

     # 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)

