Subject Re: [Firebird-Java] Write table from R into Firebird server error
Author Mark Rotteveel
On Wed, 5 Jun 2013 10:49:55 +0200, Huidong TIAN <tienhuitung@...>
wrote:
> Hi,
>
> I need to write some data.frame from R into Firebird server. Connect,
> Query and dbReadTable worked well. However, when try to write data into
> database, I encountered the following error:
> *
> *
> *> Tab <- dbGetQuery(conn, "select first 1000 * from
GROUP_REGISTRATIONS")*
> *> head(Tab)*
> * *ID DATE_CHECKED YEAR_OF_DIAGNOSIS CODING_GROUP
> MALIGN_REGISTERED
> 1 1 2007-02-04 2007 13 - URO/Hud
> 7
> 2 2 2007-02-11 2007 13 - URO/Hud
> 50
> 3 3 2007-02-18 2007 13 - URO/Hud
> 71
> 4 4 2007-02-25 2007 13 - URO/Hud
> 77
> 5 5 2007-03-04 2007 11 - LuNCH/Sarkom/Non-solid
> 1
> 6 6 2007-03-04 2007 12 - GyM *
> 11*
> *> dbWriteTable(conn, "Tab_0", Tab)*
> Error in .verify.JDBC.result(s, "Unable to execute JDBC statement ",
> statement) :
> Unable to execute JDBC statement INSERT INTO Tab_0 VALUES(?,?,?,?,?)
(GDS
> Exception. 335544569. Dynamic SQL Error
> SQL error code = -204
> Table unknown
> TAB_0
> At line 1, column 13)
> *> dbReadTable(conn, 'Tab_0')*
> [1] ID DATE_CHECKED YEAR_OF_DIAGNOSIS CODING_GROUP
> MALIGN_REGISTERED
> <0 rows> (or 0-length row.names)
>
>
> An friend suggest that could because the new table has not been
'commit',
> so in the Error message appeared 'Table unknow'.
> I checked the help document for dbWriteTable (it's a R function), and it
> says "any optional arguments that the underlying database driver
supports"
> can be passed into dbWriteTable. So, what kind of argument I should
give?
> like "autocommit"?

A JDBC connection is autoCommit=true by default, so that doesn't explain
it. IIRC there is no connection property to change that behavior. Also
AFAIK you actually can use a table in the same transaction that created (if
that is wise is a whole different matter).

I will see if I can find a solution, but I don't know R at all.

Mark