Connect R in 1 Minute

R is installed, and a method of using Machbase and R using RODBC will be described. The DSN name is set to 'machbase' and the contents set in ~ / .odbc.ini can be checked.
Please refer to the following document for explanation of RODBC function type and detailed usage.
https://cran.r-project.org/web/packages/RODBC/vignettes/RODBC.pdf

Step 1 : Open the connection
Run R and connect using RODBC. You must set the option, believeNRows = FALSE, case = "toupper".

$ R
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.


> library("RODBC")

> channel <- odbcConnect("machbase", believeNRows=FALSE, case="toupper")

Step 2: Retrieve meta information

> sqlTables(channel)

> sqlColumns(channel, "sample_table")

Step 3 : Retrieve data

> res <- sqlQuery(channel, "select * from sample_table limit 10")
> res

Step 4 : Close connection

> odbcClose(channel)

> odbcCloseAll()

> q()

$

results matching ""

    No results matching ""