Subject Re: Write table from R into Firebird server error
Author fb_database
--- In Firebird-Java@yahoogroups.com, Mark Rotteveel <mark@...> wrote:
>
> 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
>

Hi!

I have encountered many same kind of Errors and Problems ; including with Table unknown errors :o

This is not the cause of FireBird & JDBC ! :)

I give you a trick : take care of some possible special ASCII characters that appear as white chars (as space chars) : but they are in fact special chars ! Take care if you use some COPY/PASTE Text queries. It is a big source of unknown problems and sometimes, a possible source of data errors inside the Database.

You can more encounter that problem if you use COPY/PASTE of text between Windows & Linux ! Linux could share differently ASCII texts than Windows characters Set : you can encounter some similar problems.

It could certainly exists some utilities or Linux command that could permit to check that for your "text queries". If not copy and paste many times your text in a not formated utilities example notepad. But it is not sure at 100%. In case of problem remove & replace manually white char with your hands :)

I do not know if it help... but take care of special chars that appear as "white space chars" in the queries ;)

J.