I am trying a solve an ssue where creating a new table and inserting data that results in error such as this: [Error 3932] [SQLState 25000] Only an ET or null statement is legal after a DDL Statement.
The operation is very simple, we basically look at a set of data, massage it using R and try to insert back into a table.
Here are the sample script I modified from TD Exchange:
tdf <- td.data.frame("calendar")
my.stats <- td.stats(tdf,"year_of_calendar", c("cnt","min","max","mean"))
dbWriteTable(conn = tdConnection, name = "DWSP_ETL_STG.testme", value = my.stats, row.names = F, overwrite = T, append = T)
The last line is the problem where Error 3932 occurs.
We tried the normal dbConnect method and put in TMODE=ANSI or TERA but that does not help either.
drv = JDBC("com.teradata.jdbc.TeraDriver","c:/teradatajdbc/terajdbc4.jar")
Many thanks for your help!!!!
I was also not able to do it.
DBQL states that both operations dbWriteTable and as.td.data.frame start with an BT; before the CREATE table is executed.
And in this case the TMODE=TERA does not help as in explizit transaction was started.
So question is if someone ever had been able to load data via as.td.data.frame and JDBC???
Thank you Ulrich! We will go with the sqlSave RODBC route for now. The fast=true option does speed up the insertion due to parameterized inserts but does have some datatype issue such as Date. But my colleage figured out a way to do so by using varTypes:
Yes, looks like ODBC will do the trick but I would be also very interested in a JDBC solution...
Error 3932 is a Teradata Database error, not a Teradata JDBC Driver problem.
Please read Andreas Marek's blog for information about how to use the Teradata JDBC Driver with R.