使用R JDBC插入Teradata

时间:2021-07-23 02:53:12

I am using R JDBC and teradataR to connect R to teradata. I would like to write a table using the function dbWriteTable, but am receiving this error

我正在使用R JDBC和teradataR将R连接到teradata。我想使用函数dbWriteTable编写一个表,但是收到此错误

[Error 3932] [SQLState 25000] Only an ET or null statement is legal after a DDL Statement.)

[错误3932] [SQLState 25000]在DDL语句之后,只有ET或null语句才合法。)

This works perfectly fine using RMySQL on a MySQL database.

这在MySQL数据库上使用RMySQL完全正常。

There is a similar thread here where the problem was believed to be the lack of a 'begin transaction', but turned out that wasn't the case http://forums.teradata.com/forum/extensibility/teradata-r-create-table-based-on-a-data-frame-using-jdbc

这里有一个类似的线程,其中问题被认为是缺乏“开始交易”,但事实证明并非如此http://forums.teradata.com/forum/extensibility/teradata-r-create -table基于-上一个数据帧-使用-JDBC

1 个解决方案

#1


0  

If you use a DDL statement alongwith DML statements during parallel execution (; semicolon on the next line) or in ANSI mode, and the DDL statement is not the last statement in the block, you will get this error.

如果在并行执行期间使用DDL语句和DML语句(在下一行上使用分号)或在ANSI模式下使用DDL语句,并且DDL语句不是块中的最后一个语句,则会出现此错误。

select * from employee
;create table dept as select * from tmp_dept with no data
;update table employee set name = 'abc' where id = 101;

As you observe, DDL will result in implicit commits; while in a transaction either the entire transaction is committed else rolled back. I think you now get the intuition. Please check if removing the DDL code and only using DML solves the problem

如您所见,DDL将导致隐式提交;而在事务中,整个事务都被提交,否则回滚。我想你现在得到了直觉。请检查是否删除DDL代码并仅使用DML解决问题

#1


0  

If you use a DDL statement alongwith DML statements during parallel execution (; semicolon on the next line) or in ANSI mode, and the DDL statement is not the last statement in the block, you will get this error.

如果在并行执行期间使用DDL语句和DML语句(在下一行上使用分号)或在ANSI模式下使用DDL语句,并且DDL语句不是块中的最后一个语句,则会出现此错误。

select * from employee
;create table dept as select * from tmp_dept with no data
;update table employee set name = 'abc' where id = 101;

As you observe, DDL will result in implicit commits; while in a transaction either the entire transaction is committed else rolled back. I think you now get the intuition. Please check if removing the DDL code and only using DML solves the problem

如您所见,DDL将导致隐式提交;而在事务中,整个事务都被提交,否则回滚。我想你现在得到了直觉。请检查是否删除DDL代码并仅使用DML解决问题