prestodb/presto · error · SQLFeatureNotSupportedException
createNClob
Error message
createNClob
What it means
PrestoConnection.createNClob() unconditionally throws SQLFeatureNotSupportedException("createNClob"). National-character-set Clob objects (NClob) are not implemented by the driver; the method is a stub that always fails. Presto treats all text as UTF-8 VARCHAR, so NClob has no server-side counterpart.
Source
Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoConnection.java:519
@Override
public Clob createClob()
throws SQLException
{
throw new SQLFeatureNotSupportedException("createClob");
}
@Override
public Blob createBlob()
throws SQLException
{
throw new SQLFeatureNotSupportedException("createBlob");
}
@Override
public NClob createNClob()
throws SQLException
{
throw new SQLFeatureNotSupportedException("createNClob");
}
@Override
public SQLXML createSQLXML()
throws SQLException
{
throw new SQLFeatureNotSupportedException("createSQLXML");
}
@Override
public boolean isValid(int timeout)
throws SQLException
{
if (timeout < 0) {
throw new SQLException("Timeout is negative");
}
return !isClosed();
}View on GitHub (pinned to 55bb57d202)
Solutions
- Use setString/getString instead of NClob — Presto VARCHAR is already UTF-8
- Drop NClob-specific branches in generic data-binding code
- Fall back to string binding when SQLFeatureNotSupportedException is caught
Example fix
// before NClob nclob = connection.createNClob(); nclob.setString(1, unicodeText); ps.setNClob(1, nclob); // after ps.setString(1, unicodeText);
Defensive patterns
Strategy: try-catch
Validate before calling
DatabaseMetaData meta = connection.getMetaData();
if (meta.getDriverName().contains("Presto")) {
// driver does not support createNClob — Presto text is UTF-8 VARCHAR
} Type guard
static boolean supportsClientNClob(DatabaseMetaData meta) throws SQLException {
return !meta.getDriverName().contains("Presto");
} Try / catch
try {
NClob nclob = connection.createNClob();
// ... use nclob
} catch (SQLFeatureNotSupportedException e) {
// fall back: ps.setString(...) for Unicode text
} Prevention
- Treat all Presto text as UTF-8 VARCHAR; skip NCHAR/NVARCHAR-specific paths
- Remove NClob branches from generic JDBC helpers when targeting Presto
- Bind Unicode text with setString and verify in integration tests
When it happens
Trigger: Calling connection.createNClob(), or code paths that bind NCHAR/NVARCHAR parameters via setNClob using a created NClob.
Common situations: Migrating from SQL Server/Oracle where NClob is required for Unicode text; generic JDBC layers that distinguish Clob vs NClob types.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/f6e26854e5a297e7.
Report an issue: GitHub.