apache/shardingsphere · error · SQLFeatureNotSupportedException
getParameterMode
Error message
getParameterMode
What it means
SQLFeatureNotSupportedException thrown by AbstractUnsupportedOperationParameterMetaData.getParameterMode(int) (parameterModeIn/Out/InOut). ShardingSphere's parsed SQLStatement carries no IN/OUT mode information for JDBC-style '?' placeholders, and the driver does not support callable out-parameters this way, so the final method always throws.
Source
Thrown at jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationParameterMetaData.java:68
@Override
public final int getParameterType(final int parameter) throws SQLException {
throw new SQLFeatureNotSupportedException("getParameterType");
}
@Override
public final String getParameterTypeName(final int parameter) throws SQLException {
throw new SQLFeatureNotSupportedException("getParameterTypeName");
}
@Override
public final String getParameterClassName(final int parameter) throws SQLException {
throw new SQLFeatureNotSupportedException("getParameterClassName");
}
@Override
public final int getParameterMode(final int parameter) throws SQLException {
throw new SQLFeatureNotSupportedException("getParameterMode");
}
}
View on GitHub (pinned to e952770a21)
Solutions
- Assume parameterModeIn for every '?' in a PreparedStatement; that is the only mode plain SQL binding has.
- Use CallableStatement metadata on a plain datasource for actual stored procedures; ShardingSphere's inline JDBC path does not provide it.
- Catch SQLFeatureNotSupportedException and continue with the default IN-mode behavior.
Example fix
// before int mode = pmd.getParameterMode(1); // after int mode = ParameterMetaData.parameterModeIn; // '?' in a PreparedStatement is always IN
Defensive patterns
Strategy: validation
Validate before calling
int mode = ParameterMetaData.parameterModeIn; // correct for every '?' in a PreparedStatement; skip getParameterMode entirely
Try / catch
try { mode = pmd.getParameterMode(1); } catch (final SQLFeatureNotSupportedException e) { mode = ParameterMetaData.parameterModeIn; } Prevention
- Assume IN mode for PreparedStatement binds
- Use CallableStatement on a plain datasource for OUT parameters
- Do not build codegen that requires parameter modes from sharded connections
When it happens
Trigger: ps.getParameterMetaData().getParameterMode(i) on jdbc:shardingsphere:. Hit by stored-procedure wrappers and generic codegen tools that classify parameters before binding.
Common situations: Code generators (queryDSL-like mappers, CRUD UI builders) run against the sharded datasource; apps moved from a driver that returned parameterModeIn.
Related errors
AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14).
Data as JSON: /api/errors/410c831afa52d72d.
Report an issue: GitHub.