tursodatabase/turso · warning · SQLFeatureNotSupportedException

createClob not supported

Error message

createClob not supported

What it means

Connection.createClob() unconditionally throws SQLFeatureNotSupportedException. The driver does not implement client-side LOB objects; text is passed as plain Java String values through the text bind path, so there is never a need for a Clob intermediary on this engine.

Source

Thrown at bindings/java/src/main/java/tech/turso/jdbc4/JDBC4Connection.java:268

  public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
    return prepareStatement(sql);
  }

  @Override
  public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
    // TODO: maybe we can enhance this functionality by using columnIndexes
    return prepareStatement(sql);
  }

  @Override
  public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
    // TODO: maybe we can enhance this functionality by using columnNames
    return prepareStatement(sql);
  }

  @Override
  public Clob createClob() throws SQLException {
    throw new SQLFeatureNotSupportedException("createClob not supported");
  }

  @Override
  public Blob createBlob() throws SQLException {
    throw new SQLFeatureNotSupportedException("createBlob not supported");
  }

  @Override
  public NClob createNClob() throws SQLException {
    throw new SQLFeatureNotSupportedException("createNClob not supported");
  }

  @Override
  @SkipNullableCheck
  public SQLXML createSQLXML() throws SQLException {
    throw new SQLFeatureNotSupportedException("createSQLXML not supported");
  }

View on GitHub (pinned to bad083fafb)

Solutions

  1. Bind the text directly with setString/ps.bindText; SQLite-style TEXT columns take unbounded strings.
  2. For Hibernate @Lob String fields, use a materialized String mapping (e.g., @Lob with String type or a custom UserType that reads/writes strings).
  3. Replace setClob(i, clob) flows with setString(i, clobText).
  4. Remove createClob calls from utility code; there is no flag to enable them.

Example fix

// before
Clob clob = conn.createClob(); // throws
clob.setString(1, articleBody);
ps.setClob(2, clob);

// after
ps.setString(2, articleBody); // TEXT column, no Clob object needed
Defensive patterns

Strategy: fallback

Validate before calling

if (conn.getMetaData().supportsStoredFunctionsUsingCallSyntax() /* proxy check */ || true) {
    // simplest: never build Clobs; bind the string directly
    ps.setString(parameterIndex, text);
}

Try / catch

try {
    Clob clob = conn.createClob();
    clob.setString(1, text);
    ps.setClob(i, clob);
} catch (SQLFeatureNotSupportedException e) {
    ps.setString(i, text); // fallback: bind the raw string
}

Prevention

When it happens

Trigger: Direct conn.createClob() calls; JPA/Hibernate materializing @Lob String attributes into Clobs; generic JDBC code ported from tutorials that demonstrate Clob usage; frameworks preparing Clob for setCharacterStream flows.

Common situations: Hibernate mapping @Lob on String fields; document/article storage code written against PostgreSQL/Oracle; copy-pasted JDBC LOB examples; migration of code that stores large text via Clob objects.

Related errors


AI-assisted analysis of tursodatabase/turso@bad083fafb (2026-08-16). Data as JSON: /api/errors/be2b32b841245edc. Report an issue: GitHub.