apache/shardingsphere · error · SQLFeatureNotSupportedException
getURL
Error message
getURL
What it means
getURL(int columnIndex) throws SQLFeatureNotSupportedException("getURL") unconditionally at AbstractUnsupportedGeneratedKeysResultSet:212, so it fails on ShardingSphere's GeneratedKeysResultSet. The method (JDBC 3.0, largely DATALINK-specific and unsupported even by many native drivers) has no implementation for the synthesized numeric key column.
Source
Thrown at jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedGeneratedKeysResultSet.java:212
@Override
public final Blob getBlob(final String columnLabel) throws SQLException {
throw new SQLFeatureNotSupportedException("getBlob");
}
@Override
public final Clob getClob(final int columnIndex) throws SQLException {
throw new SQLFeatureNotSupportedException("getClob");
}
@Override
public final Clob getClob(final String columnLabel) throws SQLException {
throw new SQLFeatureNotSupportedException("getClob");
}
@Override
public final URL getURL(final int columnIndex) throws SQLException {
throw new SQLFeatureNotSupportedException("getURL");
}
@Override
public final URL getURL(final String columnLabel) throws SQLException {
throw new SQLFeatureNotSupportedException("getURL");
}
@Override
public final SQLXML getSQLXML(final int columnIndex) throws SQLException {
throw new SQLFeatureNotSupportedException("getSQLXML");
}
@Override
public final SQLXML getSQLXML(final String columnLabel) throws SQLException {
throw new SQLFeatureNotSupportedException("getSQLXML");
}
}
View on GitHub (pinned to e952770a21)
Solutions
- Use getObject(1)/getLong(1) and construct any URL in application code.
- Remove getURL probes from generic accessor walkers — the JDBC Datalink type is almost never what generated keys carry.
- Catch SQLFeatureNotSupportedException in probe code and record the accessor as unsupported.
- Ensure tests distinguish 'unsupported accessor' from 'broken statement' — this exception is expected here.
Example fix
// before URL u = keys.getURL(1); // after Object key = keys.getObject(1); // build URL in app code if actually needed
Defensive patterns
Strategy: try-catch
Validate before calling
Object v = keys.getObject(1); // DATALINK never applies to generated keys
Type guard
private static boolean isGeneratedKeysRs(ResultSet rs) {
return rs.getClass().getName().endsWith("GeneratedKeysResultSet");
} Try / catch
try {
URL u = rs.getURL(1);
} catch (SQLFeatureNotSupportedException e) {
Object key = rs.getObject(1);
} Prevention
- Remove getURL from accessor-matrix walkers; DATALINK is rarely supported anywhere.
- Build URLs in application code from scalar values.
- Treat SQLFeatureNotSupportedException in probes as expected metadata.
When it happens
Trigger: Calling resultSet.getURL(1) on the keys ResultSet — usually a generic accessor-matrix walker that tries every typed getter, or column-statistics code that probes capabilities by calling all accessors.
Common situations: Reflection-based ORM mappers enumerating all getX methods; capability-probing test suites; code ported from apps where getURL was used casually on MySQL (where it throws SQLFeatureNotSupportedException too, but sometimes surfaced differently); failure noticed after moving to ShardingSphere-JDBC.
Related errors
AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14).
Data as JSON: /api/errors/cf1d1c858d92ee07.
Report an issue: GitHub.