prestodb/presto · error · SQLFeatureNotSupportedException

createSQLXML

Error message

createSQLXML

What it means

PrestoConnection.createSQLXML() unconditionally throws SQLFeatureNotSupportedException("createSQLXML"). The driver does not implement the JDBC 4.0 SQLXML type, so the stub always fails without contacting the server. XML must be handled as application-level strings or binary data.

Source

Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoConnection.java:526

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

    @Override
    public void setClientInfo(String name, String value)
            throws SQLClientInfoException
    {
        requireNonNull(name, "name is null");
        if (value != null) {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Store XML as VARCHAR (or JSON) and bind with setString
  2. Serialize/deserialize XML in application code (e.g. DOM/JAXB) instead of SQLXML
  3. Catch SQLFeatureNotSupportedException and fall back to string binding

Example fix

// before
SQLXML xml = connection.createSQLXML();
xml.setString(doc);
ps.setSQLXML(1, xml);
// after
ps.setString(1, doc);
Defensive patterns

Strategy: try-catch

Validate before calling

DatabaseMetaData meta = connection.getMetaData();
if (meta.getDriverName().contains("Presto")) {
    // driver does not support createSQLXML — handle XML as string
}

Type guard

static boolean supportsSQLXML(DatabaseMetaData meta) throws SQLException {
    return !meta.getDriverName().contains("Presto");
}

Try / catch

try {
    SQLXML xml = connection.createSQLXML();
    // ... use xml
} catch (SQLFeatureNotSupportedException e) {
    // fall back: ps.setString(...) with the serialized document
}

Prevention

When it happens

Trigger: Calling connection.createSQLXML(), or frameworks binding XML-typed parameters through PreparedStatement.setSQLXML.

Common situations: Applications storing XML documents in VARCHAR/JSON columns ported from databases with native XML types; ORMs with SQLXML type handlers enabled.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/edb9e1a189c3b229. Report an issue: GitHub.