{"record":{"id":"eba590276c94dbed","repo":"apache/shardingsphere","slug":"createarrayof","errorCode":null,"errorMessage":"createArrayOf","messagePattern":"createArrayOf","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationConnection.java","lineNumber":89,"sourceCode":"    \n    @Override\n    public final void setTypeMap(final Map<String, Class<?>> map) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"setTypeMap\");\n    }\n    \n    @Override\n    public int getNetworkTimeout() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getNetworkTimeout\");\n    }\n    \n    @Override\n    public void setNetworkTimeout(final Executor executor, final int milliseconds) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"setNetworkTimeout\");\n    }\n    \n    @Override\n    public Array createArrayOf(final String typeName, final Object[] elements) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"createArrayOf\");\n    }\n    \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","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationConnection.java#L71-L107","documentation":"ShardingSphere's JDBC driver does not implement the java.sql.Connection method createArrayOf (creating an java.sql.Array object for sending SQL ARRAY values to the database). The abstract base class AbstractUnsupportedOperationConnection, which ShardingSphereConnection extends, overrides it as final and unconditionally throws SQLFeatureNotSupportedException. Array typed values are not supported by ShardingSphere's parameter rewriting pipeline, so the factory method always throws. The exception is thrown the moment the method is invoked on any connection produced by the ShardingSphere Driver.","triggerScenarios":"Calling Connection.createArrayOf(typeName, elements) on a ShardingSphere connection (usually before PreparedStatement.setArray).","commonSituations":"PostgreSQL applications binding array parameters (e.g. integer[] in ANY(...) queries); ORMs (Hibernate array types, jOOQ ARRAY binding) that construct java.sql.Array via this factory; batch code migrating from the native pgjdbc driver.","solutions":["Rewrite the query to avoid SQL arrays: expand values with IN-lists, use ANY/ARRAY literals inline in SQL text, or move array handling into application code.","For PostgreSQL specifically, use string_agg/array_to_string-style SQL, or pass arrays as formatted literal strings with ::cast in the SQL.","Unwrap the underlying connection (e.g. connection.unwrap(PgConnection.class)) and create the Array on it, then set it on the ShardingSphere PreparedStatement only if array parameters actually pass through your version's pipeline - verify with sql-show before relying on it.","Point the array-dependent code path at a separate native 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.createArrayOf(/* args */);\n} catch (final SQLFeatureNotSupportedException e) {\n    // expected on ShardingSphere connections: fall back to supported API\n    log.debug(\"Driver does not support createArrayOf, using fallback\", e);\n}","preventionTips":["Avoid java.sql.Array binding; expand arrays into IN-lists or inline SQL array literals for PostgreSQL backends.","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"}