{"record":{"id":"fa2400fc25441bb3","repo":"apache/shardingsphere","slug":"createsqlxml","errorCode":null,"errorMessage":"createSQLXML","messagePattern":"createSQLXML","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationConnection.java","lineNumber":109,"sourceCode":"    \n    @Override\n    public final Blob createBlob() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"createBlob\");\n    }\n    \n    @Override\n    public Clob createClob() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"createClob\");\n    }\n    \n    @Override\n    public final NClob createNClob() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"createNClob\");\n    }\n    \n    @Override\n    public final SQLXML createSQLXML() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"createSQLXML\");\n    }\n    \n    @Override\n    public final Struct createStruct(final String typeName, final Object[] attributes) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"createStruct\");\n    }\n    \n    @Override\n    public final Properties getClientInfo() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getClientInfo\");\n    }\n    \n    @Override\n    public final String getClientInfo(final String name) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getClientInfo name\");\n    }\n    \n    @Override","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationConnection.java#L91-L127","documentation":"ShardingSphere's JDBC driver does not implement the java.sql.Connection method createSQLXML (creating an empty java.sql.SQLXML object for writing XML data and binding it via setSQLXML). The abstract base class AbstractUnsupportedOperationConnection, which ShardingSphereConnection extends, overrides it as final and unconditionally throws SQLFeatureNotSupportedException. ShardingSphere does not implement SQLXML plumbing, so the factory method always throws on its connections. The exception is thrown the moment the method is invoked on any connection produced by the ShardingSphere Driver.","triggerScenarios":"Calling Connection.createSQLXML() on a ShardingSphere connection.","commonSituations":"SQL Server / DB2 / PostgreSQL applications storing XML columns via SQLXML objects; ORM XML mapping types that call createSQLXML during flush.","solutions":["Send XML as a String or stream: setString / setCharacterStream with the backend column typed as XML (PostgreSQL xml, SQL Server XML) usually works through ShardingSphere's normal parameter pipeline.","For SQL Server specifically, use setBinaryStream with UTF-8 bytes for XML parameters, or wrap with SQLXMLDataModel only on a native connection.","Route XML-heavy operations through a separate non-sharded DataSource."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"boolean supportsOp = false;\ntry {\n    connection.getMetaData(); // connection is alive\n    // JDBC has no capability flag for individual methods; probe once per JVM:\n    supportsOp = probeSupport(connection); // reflective/one-time guarded call\n} catch (final SQLException ignored) {\n}\n// Simpler and recommended: capability-check by driver URL\nboolean isShardingSphere = url.startsWith(\"jdbc:shardingsphere:\");\nif (isShardingSphere) {\n    // skip the unsupported call, use the alternative API path\n}","typeGuard":null,"tryCatchPattern":"try {\n    connection.createSQLXML(/* args */);\n} catch (final SQLFeatureNotSupportedException e) {\n    // expected on ShardingSphere connections: fall back to supported API\n    log.debug(\"Driver does not support createSQLXML, using fallback\", e);\n}","preventionTips":["Pass XML as String/Reader parameters rather than SQLXML objects; verify with sql-show=true that the routed SQL is valid for the backend.","Check the JDBC URL before calling optional JDBC 4 methods: connections starting with jdbc:shardingsphere: never support the lob/network-timeout/client-info/callable APIs.","Catch java.sql.SQLFeatureNotSupportedException (parent of ShardingSphere's UnsupportedSQLOperationException) around optional driver-capability calls so the application degrades gracefully."],"tags":["jdbc","shardingsphere","unsupported-operation","connection-api"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}