tursodatabase/turso · warning · SQLFeatureNotSupportedException

createNClob not supported

Error message

createNClob not supported

What it means

Connection.createNClob() unconditionally throws SQLFeatureNotSupportedException. NClob models national-character-set text, a concept from big-database SQL dialects that a SQLite-compatible engine does not have; all text is UTF-8 and bound as ordinary String values.

Source

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

  @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");
  }

  @Override
  public boolean isValid(int timeout) throws SQLException {
    if (isClosed()) {
      return false;
    }

    try (Statement statement = createStatement()) {
      return statement.execute("select 1;");
    }
  }

View on GitHub (pinned to bad083fafb)

Solutions

  1. Store the text as a normal TEXT column and bind with setString.
  2. Remove Hibernate @Nationalized annotations for this datasource (plain String attributes work).
  3. Replace setNClob flows with setString since all text is UTF-8 already.
  4. Delete createNClob branches in shared utility code.

Example fix

// before
NClob nclob = conn.createNClob(); // throws
nclob.setString(1, unicodeText);
ps.setNClob(2, nclob);

// after
ps.setString(2, unicodeText); // TEXT is UTF-8; no national char type needed
Defensive patterns

Strategy: fallback

Validate before calling

// no national char types on this engine; bind the string directly
ps.setString(parameterIndex, unicodeText);

Try / catch

try {
    NClob nclob = conn.createNClob();
    nclob.setString(1, unicodeText);
    ps.setNClob(i, nclob);
} catch (SQLFeatureNotSupportedException e) {
    ps.setString(i, unicodeText); // fallback: plain UTF-8 text
}

Prevention

When it happens

Trigger: Direct conn.createNClob() calls; code ported from SQL Server/DB2 where NTEXT/NVARCHAR(max) require NClob; generic LOB utility methods that branch to createNClob for 'unicode' fields; ORM dialects mapping nationalized @Nationalized attributes.

Common situations: Migrating from SQL Server with nvarchar(max) columns; Hibernate @Nationalized annotations; enterprise codebases with unicode-handling helpers that create NClobs regardless of driver.

Related errors


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