{"record":{"id":"d4253fae3c019cc7","repo":"apache/shardingsphere","slug":"getblob-d4253f","errorCode":null,"errorMessage":"getBlob","messagePattern":"getBlob","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedGeneratedKeysResultSet.java","lineNumber":192,"sourceCode":"    \n    @Override\n    public final int getFetchDirection() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getFetchDirection\");\n    }\n    \n    @Override\n    public final void setFetchSize(final int rows) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"setFetchSize\");\n    }\n    \n    @Override\n    public final int getFetchSize() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getFetchSize\");\n    }\n    \n    @Override\n    public final Blob getBlob(final int columnIndex) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getBlob\");\n    }\n    \n    @Override\n    public final Blob getBlob(final String columnLabel) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getBlob\");\n    }\n    \n    @Override\n    public final Clob getClob(final int columnIndex) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getClob\");\n    }\n    \n    @Override\n    public final Clob getClob(final String columnLabel) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getClob\");\n    }\n    \n    @Override","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedGeneratedKeysResultSet.java#L174-L210","documentation":"getBlob(int columnIndex) unconditionally throws SQLFeatureNotSupportedException(\"getBlob\") in AbstractUnsupportedGeneratedKeysResultSet:192. ShardingSphere's GeneratedKeysResultSet (the object you get from getGeneratedKeys()) exposes one synthesized numeric key column; LOB accessors are unimplemented because there is no large-object backing store behind the keys.","triggerScenarios":"Calling resultSet.getBlob(1) on the keys ResultSet — typically a generic mapper that selects getBlob when metadata or heuristics suggest binary data, or copy tools that try LOB accessors first for any column.","commonSituations":"ORM type handlers (old Hibernate BlobType) applied uniformly to all result sets; ResultSet->ResultSet copying utilities; code that assumed MySQL Connector/J behavior (which would throw or return null differently) after moving to ShardingSphere-JDBC for sharding.","solutions":["Use getLong(1)/getObject(1) to read the generated key.","Ensure LOB type handlers only run against SELECT result sets, not generated-keys result sets.","If you truly need a BLOB, fetch it with a subsequent SELECT on the returned key.","In unmodifiable third-party code, catch SQLFeatureNotSupportedException and retry with getObject(1)."],"exampleFix":"// before\nBlob b = keys.getBlob(1);\n\n// after\nlong id = keys.getLong(1);","handlingStrategy":"try-catch","validationCode":"int type = keys.getMetaData().getColumnType(1);\nif (type == Types.BIGINT || type == Types.INTEGER) { long id = keys.getLong(1); }","typeGuard":"private static boolean isGeneratedKeysRs(ResultSet rs) {\n    return rs.getClass().getName().endsWith(\"GeneratedKeysResultSet\");\n}","tryCatchPattern":"try {\n    Blob b = rs.getBlob(1);\n} catch (SQLFeatureNotSupportedException e) {\n    Object key = rs.getObject(1);\n}","preventionTips":["Enable LOB type handlers only for SELECT result sets.","Fetch BLOBs with a follow-up SELECT using the generated key.","Use getObject in generic column readers."],"tags":["jdbc","shardingsphere","generated-keys","blob","lob","unsupported-operation"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}