{"record":{"id":"869e9976a29ba18f","repo":"apache/shardingsphere","slug":"getparameterclassname","errorCode":null,"errorMessage":"getParameterClassName","messagePattern":"getParameterClassName","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationParameterMetaData.java","lineNumber":63,"sourceCode":"    \n    @Override\n    public final int getScale(final int parameter) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getScale\");\n    }\n    \n    @Override\n    public final int getParameterType(final int parameter) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getParameterType\");\n    }\n    \n    @Override\n    public final String getParameterTypeName(final int parameter) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getParameterTypeName\");\n    }\n    \n    @Override\n    public final String getParameterClassName(final int parameter) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getParameterClassName\");\n    }\n    \n    @Override\n    public final int getParameterMode(final int parameter) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getParameterMode\");\n    }\n}\n","sourceCodeStart":45,"sourceCodeEnd":71,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationParameterMetaData.java#L45-L71","documentation":"SQLFeatureNotSupportedException thrown by AbstractUnsupportedOperationParameterMetaData.getParameterClassName(int). The class name of the Java object a driver would bind to a '?' depends on backend type mapping, which ShardingSphere does not perform at prepare time (it routes SQL after local parsing), so this final method always throws.","triggerScenarios":"ps.getParameterMetaData().getParameterClassName(i) on a ShardingSphere PreparedStatement; invoked by reflective binders that instantiate parameter objects by class name.","commonSituations":"Legacy EJB/JDO-style frameworks, generic table-editing GUIs, or copy paths ported from drivers that implement getParameterClassName; surfaces right after the datasource URL is switched to jdbc:shardingsphere:.","solutions":["Drive binding from your own type map (parameter index -> Java class) instead of ParameterMetaData.","Catch SQLFeatureNotSupportedException and fall back to setObject(i, value) which lets ShardingSphere pass the value through to the backend driver.","Keep a non-sharded DataSource for the metadata-dependent module if the probe cannot be removed."],"exampleFix":"// before\nClass<?> clazz = Class.forName(pmd.getParameterClassName(1));\n\n// after\nClass<?> clazz = expectedParamTypes.get(1); // from your own mapping","handlingStrategy":"try-catch","validationCode":"Class<?> expected = paramTypeMap.get(index); if (expected == null) { ps.setObject(index, value); } // never ask ParameterMetaData for the class","typeGuard":null,"tryCatchPattern":"try { className = pmd.getParameterClassName(1); } catch (final SQLFeatureNotSupportedException e) { className = value.getClass().getName(); }","preventionTips":["Use setObject(i, value) which ShardingSphere passes through to the backend","Keep reflective binders away from ParameterMetaData","Map parameter classes in configuration, not at runtime"],"tags":["jdbc","shardingsphere","parametermetadata","sql-feature-not-supported"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}