tursodatabase/turso · error · SQLFeatureNotSupportedException

createBlob not supported

Error message

createBlob not supported

What it means

Connection.createBlob() throws SQLFeatureNotSupportedException at JDBC4Connection.java:273 - the driver never hands out client-side Blob objects. Binary data is bound with setBytes() and stored in SQLite BLOB columns directly. Any framework that materializes binary values as java.sql.Blob will trip this immediately on connection use.

Solutions

  1. Replace Blob creation with ps.setBytes(index, byteArray).
  2. Change entity attribute types from java.sql.Blob to byte[].
  3. For very large values, use setBinaryStream(index, inputStream) instead of Blob wrapping.
  4. Configure ORM LOB handling to materialize byte arrays rather than java.sql.Blob.

Example fix

// before
Blob blob = conn.createBlob(); // throws
blob.setBytes(1, data);
ps.setBlob(1, blob);

// after
ps.setBytes(1, data);
Defensive patterns

Strategy: fallback

Validate before calling

// bind binary data directly; no Blob object needed
// ps.setBytes(index, data) or ps.setBinaryStream(index, in) for large values

Try / catch

try {
    Blob blob = conn.createBlob();
    ps.setBlob(i, blob);
} catch (SQLFeatureNotSupportedException e) {
    ps.setBytes(i, data); // fallback binding
}

Prevention

When it happens

Trigger: conn.createBlob() + blob.setBytes(...) + ps.setBlob(...); JPA/Hibernate attributes typed java.sql.Blob; Spring's LobHandler/DefaultLobHandler createBlob path; generic file-upload code that wraps byte arrays in Blobs before insert.

Common situations: Hibernate entity fields declared as java.sql.Blob (BlobType); migrations from Oracle/DB2 where Blob wrapping is standard; media/document storage code that follows JDBC LOB tutorials; test fixtures that build Blobs programmatically.

Related errors


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

Appendix: source

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

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

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

View on GitHub (pinned to 244cde92a7)