[R] append rows to Sybase datatable using RJDBC

Li, Jing Yi jingyi.li at credit-suisse.com
Tue Oct 12 16:14:40 CEST 2010


yes. c(T,F) does return
[1] TRUE FALSE 

-----Original Message-----
From: David Winsemius [mailto:dwinsemius at comcast.net] 
Sent: Tuesday, October 12, 2010 10:00 AM
To: Li, Jing Yi
Cc: r-help at r-project.org
Subject: Re: [R] append rows to Sybase datatable using RJDBC


On Oct 12, 2010, at 9:51 AM, Li, Jing Yi wrote:

> Hi,
>
> Does anyone have experience using RJDBC library to write to Sybase 
> datatable? The jdbc driver I am using is jConnect 6.0. I can 
> successfully write into a new datatable, but have problem appending 
> rows to existing one. It either complains "Table *** already exists" 
> or simply overwrite the existing one. Here is the example.
>
> I am trying to append 'data' to the existing datatable 'tmp'
>
>> data
> 	SecurityID	Ticker
> 1	12345		AAPL
>
>> dbWriteTable(conn, "tmp", data, append = T, overwrite = F)
> Error in .local(conn, name, value, ...) :
> Table 'tmp' already exists
>
>> dbWriteTable(conn, "tmp", data, append = T)
> [1] TRUE

What happens when you type c(T,F)  at your console? Do you get [1]   
TRUE FALSE ?

>
> The first dbWriteTable failed as it's complaining "tmp already exists,

> it looks strange to me as append is set to TRUE. The second 
> dbWriteTable succeeded but it actually overwrite existing rows with 
> "data" which is not expected as append is set to TRUE and overwrite is

> default to FALSE.
>
>
> Can anyone shed me some lights here? Thanks a lot for your help!
-- 

David Winsemius, MD
West Hartford, CT


=============================================================================== 
Please access the attached hyperlink for an important el...{{dropped:4}}



More information about the R-help mailing list