tursodatabase/turso · error · SQLFeatureNotSupportedException

createClob not supported

Error message

createClob not supported

What it means

Connection.createClob() throws SQLFeatureNotSupportedException at JDBC4Connection.java:268: the driver does not implement client-side Clob value objects. Bind text directly with PreparedStatement.setString() - turso/SQLite stores TEXT natively and needs no Clob intermediary. The exception is a SQLException subclass, so it also surfaces through generic SQLException handlers.

Solutions

  1. Replace createClob + setClob with a direct ps.setString(index, text).
  2. Change entity attribute types from java.sql.Clob to String (map the column to TEXT).
  3. In Hibernate, use a dialect/configuration that materializes LOBs as String/byte[] rather than java.sql.Clob.
  4. Catch SQLFeatureNotSupportedException in generic framework adapters and fall back to setString.

Example fix

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

// after
ps.setString(2, bigText);
Defensive patterns

Strategy: fallback

Validate before calling

// bind text directly; no Clob object needed
// ps.setString(index, largeText) always works for TEXT columns

Try / catch

try {
    Clob clob = conn.createClob();
    ps.setClob(i, clob);
} catch (SQLFeatureNotSupportedException e) {
    ps.setString(i, largeText); // fallback binding
}

Prevention

When it happens

Trigger: conn.createClob() followed by clob.setString(...) and setClob(i, clob); JPA/Hibernate entity attributes typed java.sql.Clob or @Lob on String in LOB-locating modes; generic DAL utilities that always wrap large text in Clob; framework DDL/inspection code that creates Clobs for metadata round-trips.

Common situations: Hibernate mappings using ClobType / MaterializedClob on entity fields; code migrated from Oracle where Clob is the default large-text vehicle; streaming large documents through JDBC LOB APIs; libraries like Apache Commons DbUtils or Spring's LOB handlers that call createClob.

Related errors


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

Appendix: 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 244cde92a7)