dbDriver-methods             package:DBI             R Documentation

_D_a_t_a_b_a_s_e _I_n_t_e_r_f_a_c_e (_D_B_I) _C_l_a_s_s_e_s _a_n_d _d_r_i_v_e_r_s

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

     The _virtual_ classes and generics in the 'DBI' package define the
     interface to database management systems (DBMS).  They  are
     extended by packages or drivers that implement the methods in  the
     context of specific DBMS (e.g., Informix, MySQL, Oracle, ODBC, 
     PostgreSQL, SQLite).

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

       dbDriver(drvName, ...)
       dbUnloadDriver(drv, ...)     ## free up all resources

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

 drvName: character name of the driver to instantiate. 

     drv: an object that inherits from 'DBIDriver' as created by
          'dbDriver'. 

     ...: any other arguments are passed to the driver 'drvName'. 

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

     The virtual class 'DBIDriver' defines the operations  for creating
     connections and defining data type mappings. Actual driver
     classes, for instance 'RSQLite', 'RMySQL', etc. implement these
     operations in a DBMS-specific manner.

     More generally, the DBI defines a very small set of classes and
     methods that allows users and applications access DBMS with a
     common interface.  The virtual classes are 'DBIDriver' that
     individual drivers extend, 'DBIConnection' that represent
     instances of DBMS connections, and 'DBIResult' that represent the
     result of a DBMS statement.  These three classes extend the basic
     class of 'DBIObject', which serves as the root or parent of the
     class hierarchy.

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

     In the case of 'dbDriver', an driver object whose class  extends
     'DBIDriver'.  This object may be used to create connections  to
     the actual DBMS engine.

     In the case of 'dbUnloadDriver', a logical indicating whether the
     operation succeeded or not.

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

     The client part of the database communication is initialized
     (typically dynamically loading C code, etc.) but note that
     connecting to the  database engine itself needs to be done through
     calls to 'dbConnect'.

_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', 'dbListTables', 'dbReadTable'.

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

     ## Not run: 
     # create a MySQL instance for capacity of up to 25 simultaneous
     # connections.
     m <- dbDriver("MySQL", max.con = 25)
     p <- dbDriver("PgSQL")

     # open the connection using user, password, etc., as
     con <- dbConnect(m, user="ip", password = "traffic", dbname="iptraffic")
     rs <- dbSubmitQuery(con, 
              "select * from HTTP_ACCESS where IP_ADDRESS = '127.0.0.1'")
     df <- fetch(rs, n = 50)
     df2 <- fetch(rs, n = -1)
     dbClearResult(rs)

     pcon <- dbConnect(p, "user", "password", "dbname")
     dbListTables(pcon)
     ## End(Not run)

