apache/shardingsphere · error · SQLFeatureNotSupportedException
isSigned
Error message
isSigned
What it means
SQLFeatureNotSupportedException thrown by AbstractUnsupportedOperationParameterMetaData.isSigned(int). ShardingSphere's ParameterMetaData is built purely from the locally parsed SQLStatement (ShardingSphereParameterMetaData only implements getParameterCount()); signedness of a '?' placeholder is not representable without backend type info, so the method is final and always throws.
Source
Thrown at jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationParameterMetaData.java:38
import org.apache.shardingsphere.driver.jdbc.adapter.WrapperAdapter;
import java.sql.ParameterMetaData;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
/**
* Unsupported {@code ParameterMetaData} methods.
*/
public abstract class AbstractUnsupportedOperationParameterMetaData extends WrapperAdapter implements ParameterMetaData {
@Override
public final int isNullable(final int parameter) throws SQLException {
throw new SQLFeatureNotSupportedException("isNullable");
}
@Override
public final boolean isSigned(final int parameter) throws SQLException {
throw new SQLFeatureNotSupportedException("isSigned");
}
@Override
public final int getPrecision(final int parameter) throws SQLException {
throw new SQLFeatureNotSupportedException("getPrecision");
}
@Override
public final int getScale(final int parameter) throws SQLException {
throw new SQLFeatureNotSupportedException("getScale");
}
@Override
public final int getParameterType(final int parameter) throws SQLException {
throw new SQLFeatureNotSupportedException("getParameterType");
}
@OverrideView on GitHub (pinned to e952770a21)
Solutions
- Remove the isSigned probe when running against ShardingSphere; bind values with setBigDecimal/setLong which ignore signedness.
- If sign matters, read it from DatabaseMetaData.getColumns of the underlying database instead of ParameterMetaData.
- Catch SQLFeatureNotSupportedException first and treat the parameter as signed-unknown (true is the safe default for numeric binding).
Example fix
// before boolean signed = pmd.isSigned(1); // after boolean signed = true; // assume signed; ShardingSphere ParameterMetaData cannot report it
Defensive patterns
Strategy: try-catch
Validate before calling
if (!conn.getMetaData().getDriverName().toLowerCase().contains("shardingsphere")) { boolean s = pmd.isSigned(1); } Type guard
static boolean reportsParameterSign(final ParameterMetaData pmd) {
try { pmd.isSigned(1); return true; } catch (final SQLFeatureNotSupportedException e) { return false; }
} Try / catch
try {
signed = pmd.isSigned(1);
} catch (final SQLFeatureNotSupportedException e) {
signed = true; // safe default for numeric binding
} Prevention
- Do not branch binding logic on parameter signedness
- Bind with setBigDecimal/setLong which are sign-agnostic
- Keep a metadata-probe feature check per driver
When it happens
Trigger: Calling ps.getParameterMetaData().isSigned(i) on a jdbc:shardingsphere: PreparedStatement. Typical offenders: schema-inspection utilities, JDBC 4 compliance test suites, and frameworks that pick numeric setters based on signedness.
Common situations: Generic ORM/repositories or reporting engines migrated onto sharding-jdbc; SQLServer/Oracle to ShardingSphere driver swaps where the old driver answered isSigned; automated DB-compat test suites failing only on sharded datasources.
Related errors
AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14).
Data as JSON: /api/errors/f54bdc244778fa10.
Report an issue: GitHub.