[R] SQL-Interface

Michael Lapsley mlapsley at ndirect.co.uk
Mon Oct 4 21:27:32 CEST 1999


As it happens I am just in the late stages of writing an ODBC R library.
The code is inspired by  Torston Hothorn's RmSql driver (hope you don't mind): 
most of the C code is now mine,
but I used his driver as a template and his R code works with only minor
changes.

I decided to try and implement this after installing unixODBC so that I could
use StarOffice with Mysql.  unixODBC (genix.net/unixODBC) c/w drivers of mSql,
postgres, csv (broken, due to be fixed) and Sybase (planned, no date).  The
MySql driver comes from the Mysql site.

iODBC (www.iodbc.org) may work, but is is an unknown as far as I am concerned
and does not appear to c/w a driver set.


I have more or less finished the C library for R and it works superficially at
least with MySql:  more testing is needed however since a sigsegV brings R down
with it!  It _ought_ to compile under a Windoze compiler, since I got the API
info from the microsoft site, but as I take a hack and slash approach to
programming it may not!  Any takers to try?  Presumably one could then get at
microsoft-type databases over a net.  Unfortunately one would need un*x drivers
to do so from a un*x machine; perhaps someone will write some.

What I need to do now is write some high level functions in S.  What I had in
mind was:

odbcConnect(dsn,user,pwd,host=localhost)->channel #  16 open channels poss

sqlsave(channel,dataset) # save dataset in table 'dataset' creating it if
necessary

sqlload(channel,dataset) # the reverse

sqlquery(channel,query) -> dataframe or matrix ?

sqlcopy(sourcechannel,destchannel,selectstring) # creating db as required.

Any comments?


Michael
On 04-Oct-99 Jens Oehlschlägel-Akiyoshi wrote:
> 
> Can anyone give advice how to interactively exchange data between R and
> SQL-Databases like DB2, ORACLE, MS-SQL-Server ?
> 
> If the answer is: 'currently not', this would be information for me as well.
> 
> I will summarize to the list.
> 
> Best regards
> 
> --
> Dr. Jens Oehlschlägel-Akiyoshi
> MD FACTORY GmbH
> Bayerstrasse 21
> 
> 80335 München
> 
> Tel.: 089 545 28-27
> Fax.: 089 545 28-10
> http://www.mdfactory.de
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
> -
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
> _
> 

----------------------------------
E-Mail: Michael Lapsley <mlapsley at ndirect.co.uk>
Date: 04-Oct-99
Time: 20:06:00

This message was sent by XFMail
----------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list