BigQuery JDBC驱动程序-can';t在带有准备语句的表中插入null
我创建了一个简单的测试表,如下所示:BigQuery JDBC驱动程序-can';t在带有准备语句的表中插入null,jdbc,google-bigquery,Jdbc,Google Bigquery,我创建了一个简单的测试表,如下所示: PreparedStatement statement = null; try { statement = getJdbcConnection().prepareStatement("INSERT INTO foo.bar (ID, NAME) VALUES (?, ?)"); statement.setInt(1, 1); statement.setNull(2, Types.NULL); stateme
PreparedStatement statement = null;
try {
statement = getJdbcConnection().prepareStatement("INSERT INTO foo.bar (ID, NAME) VALUES (?, ?)");
statement.setInt(1, 1);
statement.setNull(2, Types.NULL);
statement.executeUpdate();
} finally {
JdbcUtils.closeStatement(statement);
}
创建表foo.bar(id INT64,名称字符串)代码>
现在要插入一行数据,如下所示:
PreparedStatement statement = null;
try {
statement = getJdbcConnection().prepareStatement("INSERT INTO foo.bar (ID, NAME) VALUES (?, ?)");
statement.setInt(1, 1);
statement.setNull(2, Types.NULL);
statement.executeUpdate();
} finally {
JdbcUtils.closeStatement(statement);
}
我希望这会成功,实际上在BigQuery控制台中也是如此,但通过JDBC我看到:
SQL State : HY000
Error Code : 100064
Message : [Simba][BigQueryJDBCDriver](100064) The specified column type is currently unsupported by the driver for column {0}.
(原文如此)
如何将NULL作为参数传递
附录:我尝试了Types.NVARCHAR
作为实验;我收到另一个错误[Simba][JDBC](10220)驱动程序不支持此可选功能。
可能会在表属性定义中的数据类型后添加NULL修饰符