[英]R: RJDBC: use dbWriteTable with db2 to specify field types
I am trying to write an R data frame to a table in a db2 data base. 我试图将R数据帧写入db2数据库中的表。 Does anyone know what additional argument I supply to the function
dbWriteTable
in order to specify the field types of the columns? 有谁知道我提供给函数
dbWriteTable
附加参数以指定列的字段类型?
I found this similar question: RMySQL dbWriteTable with field.types , however, the solution doesn't seem to hold for db2. 我发现了一个类似的问题:具有field.types的RMySQL dbWriteTable ,但是,该解决方案似乎不适用于db2。
Cheers 干杯
You can't supply fields types using dbWriteTable
. 您不能使用
dbWriteTable
提供字段类型。 JDBC is designed to hold many data bases, so it has a minimal data types mapping : JDBC旨在容纳许多数据库,因此它具有最少的数据类型映射:
integer --> INTEGER
numeric --> DOUBLE PRECISION
else --> VARCHAR(255)
You should create you table using some sql request. 您应该使用一些sql请求创建表。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.