About the RPostgreSQL package:

    Database Interface between R and PostgreSQL

For details, see the Adobe PDF file "DBI.pdf" in the doc folder or see the
documentation using help(PostgreSQL).  Examples provided in the devTests
folder illustrate some of the functionality.

=============================================================================

Basic usage:

  ## initialize the driver to PostgreSQL
  drv <- dbDriver("PostgreSQL")

  ## create a connection to a PostgreSQL server
  con <- dbConnect(drv, user="userName", password="123456",
                   dbname="gsoc", host="10.23.34.23")

  ## run a query, leave results on the server
  rs <- dbSendQuery(con, "select * from someTable")

  ## fetch up to, say, 50 records
  dFrame <- fetch(rs, n = 50)

  ## close resultSet rs 
  dbClearResult(rs)

  ## close connection con
  dbDisconnect(con)

  ## Unload the driver drv
  dbUnloadDriver(drv)

For a more complete example, refer to the file demo.r in the devTests folder.

=============================================================================

Important Information:

1. Postgresql _must_ be configured for network access rather than just
   unix domain sockets as is the default on most installations.
  
   To activate network access you need at least to 

   a) in postgresql.conf uncomment the entry for
        listen_address = '*'
      where '*' listen to all network traffic, otherwise a comma-separated
      list of IP address can be given.

   b) in pg_hba.conf add something like
        host   all   all   127.0.0.1/32	        ident sameuser
        host   all   all   192.168.1.0/24	ident passwd
      which would provide network access from the same machine (per the
      127.0.0.1 localhost address) to the same user, and from any machine
      on the same network (assuming 192.168.1.0 is your local network) when
      authenticated by a passwd.

      See the Postgresql documentation for much, much more on this.

   c) run an identd server like gidentd, oidentd, slidentd, ... 

2. dbWriteTable method is found to fail in some flavours of Linux like RedHat
   distributions because of SELinux. SELinux is preventing PostgreSQL to
   access data from locations other than it's data folder. So one of the
   possible quick solutions is to turn off SELinux temporarily while using
   this method and turn on later.

   ## To turn off the SELinux, type the following at the command prompt
   $ echo 0 > /selinux/enforce/
   ## To turn on the SElinux, type the following at the command prompt
   $ echo 1 > /selinux/enforce/

3. The present version of RPostgreSQL can handle only one resultset per connection.

4. PostgreSQL treats table and column names as case insensitive. So always
   lowercase names are returned in PostgreSQL and hence in RPostgreSQL.

=============================================================================

Frequently Asked Questions (FAQ):

1.  What is Database Interface(DBI) ?

    The Data Base Interface (DBI) provides a layer of abstraction between R
    and relational databases. All the classes in the DBI package are virtual
    and need to be implemented using the various DBMS libraries. The vendor
    has written some functions for communicating with the database in some
    language like C, compiled the functions and the compiled code is the
    library. We write a C program that calls the functions in the library,
    when it wants to access the database. Every database library is
    different. The names of the functions vary, and the order in
    which you call them varies, and the details of passing queries to the
    functions and getting the data back out will vary. To manage this, DBI
    was extended for individual database back-ends MySQL, SQLite, Oracle,
    PostgreSQL via R packages ROracle, RMySQL, RSQLite and RPostgreSQL. 
    DBI for R-language was initially developed at Bell Labs by David James.

2.  What is RPostgreSQL ?
 
    The RPostgreSQL package provides a glue between the PostgreSQL database
    and the DBI of R. The C programming interface called libpq was used for
    communicating with PostgreSQL. 

3   What is libpq ?

    libpq is the C application programmer’s interface to PostgreSQL. libpq is
    a cross platform library providing set of library functions that allow
    client programs to pass queries to the PostgreSQL backend server and to
    receive the results of these queries.

4.  What about Rdbi/RdbiPgSQL ?

    Rdbi and RdbiPgSQL are a 'fork' of the DBI interface for R. RPostgreSQL follows
    the DBI as do ROracle, RMySQL and RSQLite.


For any queries,suggestions and comments, mail: 
 
    Sameer Kumar Prayaga <sameer.bits@gmail.com>    GSoC student for this project
    Dirk Eddelbuettel <edd@debian.org>		    GSoC mentor
                                                
