DashDB 行组织表是否支持 CLOBS?

Does DashDB row organized tables support CLOBS?

我们正在尝试将大型 CLOBS 存储到 DashDB 中以供分析。是的,已经创建的table是按行组织的

CREATE TABLE test(
  KEY VARCHAR(1000) NOT NULL,
  MP3_FILE CLOB(250M) NOT NULL,
  PRIMARY KEY(KEY)
) ORGANIZE BY ROW;

如果我们可以存储 BLOBS 就更好了,这样我们就不必通过 base64 来增加文件大小了。

然而,即使使用 CLOBS,我们也有错误:

com.ibm.db2.jcc.am.SqlSyntaxErrorException:DB2 SQL 错误:SQLCODE=-204,SQLSTATE=42704,SQLERRMC =DASH107483.TEST, 驱动程序=3.71.22

我们使用的代码类似于:

PreparedStatement pre = connection.prepareStatement("insert into test (key,mp3_file) values (?,?)");
pre.setString(1, "test");
pre.setCharacterStream(2, new StringReader(encoded), encoded.length());
int count = pre.executeUpdate();
connection.commit();
logger.info("mergedMP3 file isUpdated: " + count);
pre.close();
connection.close();

谢谢, 亚伦

我认为这个问题与 CLOB 无关。错误消息表明未找到 table DASH107483.TEST

是否有可能 table 是使用小写字符创建的(例如,名称在 DDL 中用双引号引起来)?

CREATE TABLE "test"( KEY VARCHAR(1000) NOT NULL, MP3_FILE CLOB(250M) NOT NULL, PRIMARY KEY(KEY) ) ORGANIZE BY ROW;

当你 运行

时输出是什么

SELECT TABNAME FROM SYSCAT.TABLES WHERE TABSCHEMA='DASH107483' ORDER BY TABNAME;

最终,字节的使用似乎效果很好。

PreparedStatement pre = connection.prepareStatement("insert into largespeechsynthesis(KEY,MP3_FILE) values (?,?)");
pre.setString(1, attachmentID.replace(".mp3", ""));
pre.setBytes(2, Files.readAllBytes(mergedFile.toPath()));
int count = pre.executeUpdate();
logger.info("mergedMP3 file isUpdated: " + count);
connection.commit();
pre.close();
connection.close();