[R] append rows to Sybase datatable using RJDBC

David Winsemius dwinsemius at comcast.net
Tue Oct 12 16:00:24 CEST 2010


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



More information about the R-help mailing list