
R version 2.13.1 (2011-07-08)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i386-pc-mingw32/i386 (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

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.

> ##-*- R -*-
> library(RODBC)
> library(MASS)
> USArrests[1,2] <- NA
> hills <- hills[1:15,]
> row.names(hills)[12] <- "Dollar ('$')"
> set.seed(1)
> options(digits.secs = 3)
> 
> channel <- odbcConnect("DB2")
> if(!inherits(channel, "RODBC")) q("no")
> sqlTables(channel, schema="RIPLEY")
[1] TABLE_CAT   TABLE_SCHEM TABLE_NAME  TABLE_TYPE  REMARKS    
<0 rows> (or 0-length row.names)
> sqlDrop(channel, "USArrests", errors = FALSE)
> sqlSave(channel, USArrests, rownames = "State", addPK = TRUE)
> sqlTables(channel, schema="RIPLEY")
  TABLE_CAT TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS
1      <NA>      RIPLEY  USArrests      TABLE    <NA>
> sqlColumns(channel, "USArrests")
  TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME DATA_TYPE TYPE_NAME COLUMN_SIZE
1      <NA>      RIPLEY  USArrests       State        12   VARCHAR         255
2      <NA>      RIPLEY  USArrests      Murder         8    DOUBLE          53
3      <NA>      RIPLEY  USArrests     Assault         4   INTEGER          10
4      <NA>      RIPLEY  USArrests    UrbanPop         4   INTEGER          10
5      <NA>      RIPLEY  USArrests        Rape         8    DOUBLE          53
  BUFFER_LENGTH DECIMAL_DIGITS NUM_PREC_RADIX NULLABLE REMARKS COLUMN_DEF
1           255             NA             NA        0    <NA>       <NA>
2             8             NA              2        1    <NA>       <NA>
3             4              0             10        1    <NA>       <NA>
4             4              0             10        1    <NA>       <NA>
5             8             NA              2        1    <NA>       <NA>
  SQL_DATA_TYPE SQL_DATETIME_SUB CHAR_OCTET_LENGTH ORDINAL_POSITION IS_NULLABLE
1            12               NA               255                1          NO
2             8               NA                NA                2         YES
3             4               NA                NA                3         YES
4             4               NA                NA                4         YES
5             8               NA                NA                5         YES
> sqlColumns(channel, "USArrests", special = TRUE)
[1] SCOPE          COLUMN_NAME    DATA_TYPE      TYPE_NAME      COLUMN_SIZE   
[6] BUFFER_LENGTH  DECIMAL_DIGITS PSEUDO_COLUMN 
<0 rows> (or 0-length row.names)
> sqlPrimaryKeys(channel, "USArrests")
  TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME KEY_SEQ            PK_NAME
1      <NA>      RIPLEY  USArrests       State       1 SQL090709102101900
> sqlFetch(channel, "USArrests", rownames = "State")
               Murder Assault UrbanPop Rape
Alabama          13.2      NA       58 21.2
Alaska           10.0     263       48 44.5
Arizona           8.1     294       80 31.0
Arkansas          8.8     190       50 19.5
California        9.0     276       91 40.6
Colorado          7.9     204       78 38.7
Connecticut       3.3     110       77 11.1
Delaware          5.9     238       72 15.8
Florida          15.4     335       80 31.9
Georgia          17.4     211       60 25.8
Hawaii            5.3      46       83 20.2
Idaho             2.6     120       54 14.2
Illinois         10.4     249       83 24.0
Indiana           7.2     113       65 21.0
Iowa              2.2      56       57 11.3
Kansas            6.0     115       66 18.0
Kentucky          9.7     109       52 16.3
Louisiana        15.4     249       66 22.2
Maine             2.1      83       51  7.8
Maryland         11.3     300       67 27.8
Massachusetts     4.4     149       85 16.3
Michigan         12.1     255       74 35.1
Minnesota         2.7      72       66 14.9
Mississippi      16.1     259       44 17.1
Missouri          9.0     178       70 28.2
Montana           6.0     109       53 16.4
Nebraska          4.3     102       62 16.5
Nevada           12.2     252       81 46.0
New Hampshire     2.1      57       56  9.5
New Jersey        7.4     159       89 18.8
New Mexico       11.4     285       70 32.1
New York         11.1     254       86 26.1
North Carolina   13.0     337       45 16.1
North Dakota      0.8      45       44  7.3
Ohio              7.3     120       75 21.4
Oklahoma          6.6     151       68 20.0
Oregon            4.9     159       67 29.3
Pennsylvania      6.3     106       72 14.9
Rhode Island      3.4     174       87  8.3
South Carolina   14.4     279       48 22.5
South Dakota      3.8      86       45 12.8
Tennessee        13.2     188       59 26.9
Texas            12.7     201       80 25.5
Utah              3.2     120       80 22.9
Vermont           2.2      48       32 11.2
Virginia          8.5     156       63 20.7
Washington        4.0     145       73 26.2
West Virginia     5.7      81       39  9.3
Wisconsin         2.6      53       66 10.8
Wyoming           6.8     161       60 15.6
> sqlQuery(channel, 'select "State", "Murder" from "USArrests" where "Rape" > 30 order by "Murder"')
       State Murder
1   Colorado    7.9
2    Arizona    8.1
3 California    9.0
4     Alaska   10.0
5 New Mexico   11.4
6   Michigan   12.1
7     Nevada   12.2
8    Florida   15.4
> foo <- cbind(State=row.names(USArrests), USArrests)[1:3, c(1,3)]
> foo[1,2] <- 236
> sqlUpdate(channel, foo, "USArrests")
> sqlFetch(channel, "USArrests", rownames = "State", max = 5)
           Murder Assault UrbanPop Rape
Alabama      13.2     236       58 21.2
Alaska       10.0     263       48 44.5
Arizona       8.1     294       80 31.0
Arkansas      8.8     190       50 19.5
California    9.0     276       91 40.6
> sqlFetchMore(channel, rownames = "State", max = 8)
            Murder Assault UrbanPop Rape
Colorado       7.9     204       78 38.7
Connecticut    3.3     110       77 11.1
Delaware       5.9     238       72 15.8
Florida       15.4     335       80 31.9
Georgia       17.4     211       60 25.8
Hawaii         5.3      46       83 20.2
Idaho          2.6     120       54 14.2
Illinois      10.4     249       83 24.0
> sqlDrop(channel, "USArrests")
> 
> Btest <- Atest <-
+     data.frame(x = c(paste(1:100, collapse="+"), letters[2:4]), rn=1:4)
> Btest[,1] <- Atest[c(4,1:3),1]
> sqlDrop(channel, "Atest", errors = FALSE)
> ## max for varchar is 32672, 254 for char
> colspec <- list(character="varchar(1000)", double="double",
+                 integer="integer", logical="varchar(5)")
> sqlSave(channel, Atest, typeInfo = colspec)
> sqlColumns(channel, "Atest")
  TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME DATA_TYPE TYPE_NAME COLUMN_SIZE
1      <NA>      RIPLEY      Atest    rownames        12   VARCHAR        1000
2      <NA>      RIPLEY      Atest           x        12   VARCHAR        1000
3      <NA>      RIPLEY      Atest          rn         4   INTEGER          10
  BUFFER_LENGTH DECIMAL_DIGITS NUM_PREC_RADIX NULLABLE REMARKS COLUMN_DEF
1          1000             NA             NA        1    <NA>       <NA>
2          1000             NA             NA        1    <NA>       <NA>
3             4              0             10        1    <NA>       <NA>
  SQL_DATA_TYPE SQL_DATETIME_SUB CHAR_OCTET_LENGTH ORDINAL_POSITION IS_NULLABLE
1            12               NA              1000                1         YES
2            12               NA              1000                2         YES
3             4               NA                NA                3         YES
> sqlFetch(channel, "Atest")
                                                                                                                                                                                                                                                                                                    x
1 1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+21+22+23+24+25+26+27+28+29+30+31+32+33+34+35+36+37+38+39+40+41+42+43+44+45+46+47+48+49+50+51+52+53+54+55+56+57+58+59+60+61+62+63+64+65+66+67+68+69+70+71+72+73+74+75+76+77+78+79+80+81+82+83+84+85+86+87+88+89+90+91+92+93+94+95+96+97+98+99+100
2                                                                                                                                                                                                                                                                                                   b
3                                                                                                                                                                                                                                                                                                   c
4                                                                                                                                                                                                                                                                                                   d
  rn
1  1
2  2
3  3
4  4
> sqlUpdate(channel, Btest, "Atest", index = "rn")
> sqlFetch(channel, "Atest")
                                                                                                                                                                                                                                                                                                    x
1                                                                                                                                                                                                                                                                                                   d
2 1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+21+22+23+24+25+26+27+28+29+30+31+32+33+34+35+36+37+38+39+40+41+42+43+44+45+46+47+48+49+50+51+52+53+54+55+56+57+58+59+60+61+62+63+64+65+66+67+68+69+70+71+72+73+74+75+76+77+78+79+80+81+82+83+84+85+86+87+88+89+90+91+92+93+94+95+96+97+98+99+100
3                                                                                                                                                                                                                                                                                                   b
4                                                                                                                                                                                                                                                                                                   c
  rn
1  1
2  2
3  3
4  4
> sqlDrop(channel, "Atest")
> varspec <- "varchar(1000)"; names(varspec) <- "x"
> sqlSave(channel, Atest, varTypes = varspec)
> sqlColumns(channel, "Atest")
  TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME DATA_TYPE TYPE_NAME COLUMN_SIZE
1      <NA>      RIPLEY      Atest    rownames        12   VARCHAR         255
2      <NA>      RIPLEY      Atest           x        12   VARCHAR        1000
3      <NA>      RIPLEY      Atest          rn         4   INTEGER          10
  BUFFER_LENGTH DECIMAL_DIGITS NUM_PREC_RADIX NULLABLE REMARKS COLUMN_DEF
1           255             NA             NA        1    <NA>       <NA>
2          1000             NA             NA        1    <NA>       <NA>
3             4              0             10        1    <NA>       <NA>
  SQL_DATA_TYPE SQL_DATETIME_SUB CHAR_OCTET_LENGTH ORDINAL_POSITION IS_NULLABLE
1            12               NA               255                1         YES
2            12               NA              1000                2         YES
3             4               NA                NA                3         YES
> sqlFetch(channel, "Atest")
                                                                                                                                                                                                                                                                                                    x
1 1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+21+22+23+24+25+26+27+28+29+30+31+32+33+34+35+36+37+38+39+40+41+42+43+44+45+46+47+48+49+50+51+52+53+54+55+56+57+58+59+60+61+62+63+64+65+66+67+68+69+70+71+72+73+74+75+76+77+78+79+80+81+82+83+84+85+86+87+88+89+90+91+92+93+94+95+96+97+98+99+100
2                                                                                                                                                                                                                                                                                                   b
3                                                                                                                                                                                                                                                                                                   c
4                                                                                                                                                                                                                                                                                                   d
  rn
1  1
2  2
3  3
4  4
> sqlDrop(channel, "Atest")
> 
> dates <- as.character(seq(as.Date("2004-01-01"), by="week", length=10))
> times <- paste(1:10, "05", "00", sep=":")
> dt <- as.POSIXct(paste(dates, times))
> dt <- dt + round(runif(10), 3)
> Dtest <- data.frame(dates, times, dt, logi=c(TRUE, NA, FALSE, FALSE, FALSE))
> varspec <- c("date", "time", "timestamp", "varchar(5)")
> names(varspec) <- names(Dtest)
> sqlDrop(channel, "Dtest", errors = FALSE)
> sqlSave(channel, Dtest, varTypes = varspec)
> sqlColumns(channel, "Dtest")
  TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME DATA_TYPE TYPE_NAME COLUMN_SIZE
1      <NA>      RIPLEY      Dtest    rownames        12   VARCHAR         255
2      <NA>      RIPLEY      Dtest       dates        91      DATE          10
3      <NA>      RIPLEY      Dtest       times        92      TIME           8
4      <NA>      RIPLEY      Dtest          dt        93 TIMESTAMP          26
5      <NA>      RIPLEY      Dtest        logi        12   VARCHAR           5
  BUFFER_LENGTH DECIMAL_DIGITS NUM_PREC_RADIX NULLABLE REMARKS COLUMN_DEF
1           255             NA             NA        1    <NA>       <NA>
2             6             NA             NA        1    <NA>       <NA>
3             6              0             NA        1    <NA>       <NA>
4            16              6             NA        1    <NA>       <NA>
5             5             NA             NA        1    <NA>       <NA>
  SQL_DATA_TYPE SQL_DATETIME_SUB CHAR_OCTET_LENGTH ORDINAL_POSITION IS_NULLABLE
1            12               NA               255                1         YES
2             9                1                NA                2         YES
3             9                2                NA                3         YES
4             9                3                NA                4         YES
5            12               NA                 5                5         YES
> sqlFetch(channel, "Dtest")
        dates    times                      dt  logi
1  2004-01-01 01:05:00 2004-01-01 01:05:00.371  TRUE
2  2004-01-08 02:05:00 2004-01-08 02:05:00.572    NA
3  2004-01-15 03:05:00 2004-01-15 03:05:00.907 FALSE
4  2004-01-22 04:05:00 2004-01-22 04:05:00.200 FALSE
5  2004-01-29 05:05:00 2004-01-29 05:05:00.898 FALSE
6  2004-02-05 06:05:00 2004-02-05 06:05:00.944  TRUE
7  2004-02-12 07:05:00 2004-02-12 07:05:00.661    NA
8  2004-02-19 08:05:00 2004-02-19 08:05:00.628 FALSE
9  2004-02-26 09:05:00 2004-02-26 09:05:00.062 FALSE
10 2004-03-04 10:05:00 2004-03-04 10:05:00.206 FALSE
> sqlDrop(channel, "Dtest")
> Dtest <- data.frame(dates, times, dt, logi=c(TRUE, NA, FALSE, FALSE, FALSE))
> varspec <- c("date", "time", "timestamp", "varchar(5)")
> names(varspec) <- names(Dtest)
> sqlDrop(channel, "Dtest", errors = FALSE)
> sqlSave(channel, Dtest, varTypes = varspec, fast = FALSE)
> sqlColumns(channel, "Dtest")
  TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME DATA_TYPE TYPE_NAME COLUMN_SIZE
1      <NA>      RIPLEY      Dtest    rownames        12   VARCHAR         255
2      <NA>      RIPLEY      Dtest       dates        91      DATE          10
3      <NA>      RIPLEY      Dtest       times        92      TIME           8
4      <NA>      RIPLEY      Dtest          dt        93 TIMESTAMP          26
5      <NA>      RIPLEY      Dtest        logi        12   VARCHAR           5
  BUFFER_LENGTH DECIMAL_DIGITS NUM_PREC_RADIX NULLABLE REMARKS COLUMN_DEF
1           255             NA             NA        1    <NA>       <NA>
2             6             NA             NA        1    <NA>       <NA>
3             6              0             NA        1    <NA>       <NA>
4            16              6             NA        1    <NA>       <NA>
5             5             NA             NA        1    <NA>       <NA>
  SQL_DATA_TYPE SQL_DATETIME_SUB CHAR_OCTET_LENGTH ORDINAL_POSITION IS_NULLABLE
1            12               NA               255                1         YES
2             9                1                NA                2         YES
3             9                2                NA                3         YES
4             9                3                NA                4         YES
5            12               NA                 5                5         YES
> sqlFetch(channel, "Dtest")
        dates    times                      dt  logi
1  2004-01-01 01:05:00 2004-01-01 01:05:00.371  TRUE
2  2004-01-08 02:05:00 2004-01-08 02:05:00.572    NA
3  2004-01-15 03:05:00 2004-01-15 03:05:00.907 FALSE
4  2004-01-22 04:05:00 2004-01-22 04:05:00.200 FALSE
5  2004-01-29 05:05:00 2004-01-29 05:05:00.898 FALSE
6  2004-02-05 06:05:00 2004-02-05 06:05:00.944  TRUE
7  2004-02-12 07:05:00 2004-02-12 07:05:00.661    NA
8  2004-02-19 08:05:00 2004-02-19 08:05:00.628 FALSE
9  2004-02-26 09:05:00 2004-02-26 09:05:00.062 FALSE
10 2004-03-04 10:05:00 2004-03-04 10:05:00.206 FALSE
> sqlDrop(channel, "Dtest")
> 
> sqlDrop(channel, "hills test", errors = FALSE)
> sqlSave(channel, hills, "hills test", verbose=TRUE)
Query: CREATE TABLE "hills test"  ("rownames" VARCHAR(255), "dist" DOUBLE, "climb" INTEGER, "time" DOUBLE)
Query: INSERT INTO "hills test" ( "rownames", "dist", "climb", "time" ) VALUES ( ?,?,?,? )
Binding: 'rownames' DataType 12, ColSize 255
Binding: 'dist' DataType 8, ColSize 53
Binding: 'climb' DataType 4, ColSize 10
Binding: 'time' DataType 8, ColSize 53
Parameters:
no: 1: rownames Greenmantle/***/no: 2: dist 2.5/***/no: 3: climb 650/***/no: 4: time 16.083/***/
no: 1: rownames Carnethy/***/no: 2: dist 6/***/no: 3: climb 2500/***/no: 4: time 48.35/***/
no: 1: rownames Craig Dunain/***/no: 2: dist 6/***/no: 3: climb 900/***/no: 4: time 33.65/***/
no: 1: rownames Ben Rha/***/no: 2: dist 7.5/***/no: 3: climb 800/***/no: 4: time 45.6/***/
no: 1: rownames Ben Lomond/***/no: 2: dist 8/***/no: 3: climb 3070/***/no: 4: time 62.267/***/
no: 1: rownames Goatfell/***/no: 2: dist 8/***/no: 3: climb 2866/***/no: 4: time 73.217/***/
no: 1: rownames Bens of Jura/***/no: 2: dist 16/***/no: 3: climb 7500/***/no: 4: time 204.617/***/
no: 1: rownames Cairnpapple/***/no: 2: dist 6/***/no: 3: climb 800/***/no: 4: time 36.367/***/
no: 1: rownames Scolty/***/no: 2: dist 5/***/no: 3: climb 800/***/no: 4: time 29.75/***/
no: 1: rownames Traprain/***/no: 2: dist 6/***/no: 3: climb 650/***/no: 4: time 39.75/***/
no: 1: rownames Lairig Ghru/***/no: 2: dist 28/***/no: 3: climb 2100/***/no: 4: time 192.667/***/
no: 1: rownames Dollar ('$')/***/no: 2: dist 5/***/no: 3: climb 2000/***/no: 4: time 43.05/***/
no: 1: rownames Lomonds/***/no: 2: dist 9.5/***/no: 3: climb 2200/***/no: 4: time 65/***/
no: 1: rownames Cairn Table/***/no: 2: dist 6/***/no: 3: climb 500/***/no: 4: time 44.133/***/
no: 1: rownames Eildon Two/***/no: 2: dist 4.5/***/no: 3: climb 1500/***/no: 4: time 26.933/***/
> sqlUpdate(channel, hills[11:15,], "hills test", verbose=TRUE, fast=TRUE)
Query: UPDATE "hills test" SET "dist"=?, "climb"=?, "time"=? WHERE "rownames"=?
Binding: 'dist' DataType 8, ColSize 53
Binding: 'climb' DataType 4, ColSize 10
Binding: 'time' DataType 8, ColSize 53
Binding: 'rownames' DataType 12, ColSize 255
Parameters:
no: 1: dist 28/***/no: 2: climb 2100/***/no: 3: time 192.667/***/no: 4: rownames Lairig Ghru/***/
no: 1: dist 5/***/no: 2: climb 2000/***/no: 3: time 43.05/***/no: 4: rownames Dollar ('$')/***/
no: 1: dist 9.5/***/no: 2: climb 2200/***/no: 3: time 65/***/no: 4: rownames Lomonds/***/
no: 1: dist 6/***/no: 2: climb 500/***/no: 3: time 44.133/***/no: 4: rownames Cairn Table/***/
no: 1: dist 4.5/***/no: 2: climb 1500/***/no: 3: time 26.933/***/no: 4: rownames Eildon Two/***/
> sqlFetch(channel, "hills test")
             dist climb    time
Greenmantle   2.5   650  16.083
Carnethy      6.0  2500  48.350
Craig Dunain  6.0   900  33.650
Ben Rha       7.5   800  45.600
Ben Lomond    8.0  3070  62.267
Goatfell      8.0  2866  73.217
Bens of Jura 16.0  7500 204.617
Cairnpapple   6.0   800  36.367
Scolty        5.0   800  29.750
Traprain      6.0   650  39.750
Lairig Ghru  28.0  2100 192.667
Dollar ('$')  5.0  2000  43.050
Lomonds       9.5  2200  65.000
Cairn Table   6.0   500  44.133
Eildon Two    4.5  1500  26.933
> sqlDrop(channel, "hills test")
> sqlSave(channel, hills, "hills test", verbose=TRUE, fast=FALSE)
Query: CREATE TABLE "hills test"  ("rownames" VARCHAR(255), "dist" DOUBLE, "climb" INTEGER, "time" DOUBLE)
Query: INSERT INTO "hills test" ( "rownames", "dist", "climb", "time" ) VALUES ( 'Greenmantle',  2.5,  650,  16.083 )
Query: INSERT INTO "hills test" ( "rownames", "dist", "climb", "time" ) VALUES ( 'Carnethy',  6.0, 2500,  48.350 )
Query: INSERT INTO "hills test" ( "rownames", "dist", "climb", "time" ) VALUES ( 'Craig Dunain',  6.0,  900,  33.650 )
Query: INSERT INTO "hills test" ( "rownames", "dist", "climb", "time" ) VALUES ( 'Ben Rha',  7.5,  800,  45.600 )
Query: INSERT INTO "hills test" ( "rownames", "dist", "climb", "time" ) VALUES ( 'Ben Lomond',  8.0, 3070,  62.267 )
Query: INSERT INTO "hills test" ( "rownames", "dist", "climb", "time" ) VALUES ( 'Goatfell',  8.0, 2866,  73.217 )
Query: INSERT INTO "hills test" ( "rownames", "dist", "climb", "time" ) VALUES ( 'Bens of Jura', 16.0, 7500, 204.617 )
Query: INSERT INTO "hills test" ( "rownames", "dist", "climb", "time" ) VALUES ( 'Cairnpapple',  6.0,  800,  36.367 )
Query: INSERT INTO "hills test" ( "rownames", "dist", "climb", "time" ) VALUES ( 'Scolty',  5.0,  800,  29.750 )
Query: INSERT INTO "hills test" ( "rownames", "dist", "climb", "time" ) VALUES ( 'Traprain',  6.0,  650,  39.750 )
Query: INSERT INTO "hills test" ( "rownames", "dist", "climb", "time" ) VALUES ( 'Lairig Ghru', 28.0, 2100, 192.667 )
Query: INSERT INTO "hills test" ( "rownames", "dist", "climb", "time" ) VALUES ( 'Dollar (''$'')',  5.0, 2000,  43.050 )
Query: INSERT INTO "hills test" ( "rownames", "dist", "climb", "time" ) VALUES ( 'Lomonds',  9.5, 2200,  65.000 )
Query: INSERT INTO "hills test" ( "rownames", "dist", "climb", "time" ) VALUES ( 'Cairn Table',  6.0,  500,  44.133 )
Query: INSERT INTO "hills test" ( "rownames", "dist", "climb", "time" ) VALUES ( 'Eildon Two',  4.5, 1500,  26.933 )
> sqlUpdate(channel, hills[11:15,], "hills test", verbose=TRUE, fast=FALSE)
Query: UPDATE "hills test" SET "dist"=28.0, "climb"=2100, "time"=192.667 WHERE "rownames"='Lairig Ghru'
Query: UPDATE "hills test" SET "dist"= 5.0, "climb"=2000, "time"= 43.050 WHERE "rownames"='Dollar (''$'')'
Query: UPDATE "hills test" SET "dist"= 9.5, "climb"=2200, "time"= 65.000 WHERE "rownames"='Lomonds'
Query: UPDATE "hills test" SET "dist"= 6.0, "climb"= 500, "time"= 44.133 WHERE "rownames"='Cairn Table'
Query: UPDATE "hills test" SET "dist"= 4.5, "climb"=1500, "time"= 26.933 WHERE "rownames"='Eildon Two'
> sqlDrop(channel, "hills test")
> 
> sqlTables(channel, catalog="", schema="", tableName="", tableType="%")
   TABLE_CAT TABLE_SCHEM TABLE_NAME               TABLE_TYPE REMARKS
1       <NA>        <NA>       <NA>                    ALIAS    <NA>
2       <NA>        <NA>       <NA>          HIERARCHY TABLE    <NA>
3       <NA>        <NA>       <NA>         INOPERATIVE VIEW    <NA>
4       <NA>        <NA>       <NA> MATERIALIZED QUERY TABLE    <NA>
5       <NA>        <NA>       <NA>                 NICKNAME    <NA>
6       <NA>        <NA>       <NA>             SYSTEM TABLE    <NA>
7       <NA>        <NA>       <NA>                    TABLE    <NA>
8       <NA>        <NA>       <NA>              TYPED TABLE    <NA>
9       <NA>        <NA>       <NA>               TYPED VIEW    <NA>
10      <NA>        <NA>       <NA>                     VIEW    <NA>
> ## case matters here
> # sqlQuery(channel, "create schema TEST2")
> sqlTables(channel, catalog="", schema="%", tableName="")
   TABLE_CAT    TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS
1       <NA>         NULLID       <NA>       <NA>    <NA>
2       <NA>         RIPLEY       <NA>       <NA>    <NA>
3       <NA>           SQLJ       <NA>       <NA>    <NA>
4       <NA>         SYSCAT       <NA>       <NA>    <NA>
5       <NA>         SYSFUN       <NA>       <NA>    <NA>
6       <NA>         SYSIBM       <NA>       <NA>    <NA>
7       <NA>      SYSIBMADM       <NA>       <NA>    <NA>
8       <NA> SYSIBMINTERNAL       <NA>       <NA>    <NA>
9       <NA>       SYSIBMTS       <NA>       <NA>    <NA>
10      <NA>        SYSPROC       <NA>       <NA>    <NA>
11      <NA>      SYSPUBLIC       <NA>       <NA>    <NA>
12      <NA>        SYSSTAT       <NA>       <NA>    <NA>
13      <NA>       SYSTOOLS       <NA>       <NA>    <NA>
14      <NA>          TEST2       <NA>       <NA>    <NA>
> sqlSave(channel, women, "TEST2.WOMEN")
> sqlTables(channel, catalog="", schema="%", tableName="")
   TABLE_CAT    TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS
1       <NA>         NULLID       <NA>       <NA>    <NA>
2       <NA>         RIPLEY       <NA>       <NA>    <NA>
3       <NA>           SQLJ       <NA>       <NA>    <NA>
4       <NA>         SYSCAT       <NA>       <NA>    <NA>
5       <NA>         SYSFUN       <NA>       <NA>    <NA>
6       <NA>         SYSIBM       <NA>       <NA>    <NA>
7       <NA>      SYSIBMADM       <NA>       <NA>    <NA>
8       <NA> SYSIBMINTERNAL       <NA>       <NA>    <NA>
9       <NA>       SYSIBMTS       <NA>       <NA>    <NA>
10      <NA>        SYSPROC       <NA>       <NA>    <NA>
11      <NA>      SYSPUBLIC       <NA>       <NA>    <NA>
12      <NA>        SYSSTAT       <NA>       <NA>    <NA>
13      <NA>       SYSTOOLS       <NA>       <NA>    <NA>
14      <NA>          TEST2       <NA>       <NA>    <NA>
> sqlTables(channel, tableType="TABLE")
  TABLE_CAT TABLE_SCHEM      TABLE_NAME TABLE_TYPE REMARKS
1      <NA>    SYSTOOLS   HMON_ATM_INFO      TABLE    <NA>
2      <NA>    SYSTOOLS HMON_COLLECTION      TABLE    <NA>
3      <NA>    SYSTOOLS          POLICY      TABLE    <NA>
4      <NA>       TEST2           WOMEN      TABLE    <NA>
> sqlTables(channel, schema="TEST2")
  TABLE_CAT TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS
1      <NA>       TEST2      WOMEN      TABLE    <NA>
> sqlDrop(channel, "TEST2.WOMEN")
> 
> close(channel)
