Search code examples
blobibm-cloudclobdashdb

Does DashDB row organized tables support CLOBS?


We are trying to store large CLOBS into a DashDB for analytics. Yes, the table that has been created is row organized.

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

Even better would be if we can store BLOBS so we would not have to increase the file size by base64'ing.

However, even with CLOBS, we have the error:

com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=DASH107483.TEST, DRIVER=3.71.22

The code we are using is similar to:

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();

Thanks, Aaron


Solution

  • I don't think the issue is CLOB related. The error message is indicating that the table DASH107483.TEST wasn't found.

    Any chance that table was created using lower case characters (e.g. the name was enclosed in double quotes in the DDL)?

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

    What's the output when you run

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