apache/shardingsphere · error · SQLFeatureNotSupportedException
abort
Error message
abort
What it means
ShardingSphere's JDBC driver does not implement the java.sql.Connection method abort (forcibly terminating an open connection from another thread, as specified by JDBC 4). The abstract base class AbstractUnsupportedOperationConnection, which ShardingSphereConnection extends, overrides it as final and unconditionally throws SQLFeatureNotSupportedException. ShardingSphere connections may fan out to multiple real backend connections, and coordinated cross-thread abort of all of them is not implemented, so the method always throws. The exception is thrown the moment the method is invoked on any connection produced by the ShardingSphere Driver.
Source
Thrown at jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationConnection.java:64
@Override
public final CallableStatement prepareCall(final String sql, final int resultSetType, final int resultSetConcurrency) throws SQLException {
throw new SQLFeatureNotSupportedException("prepareCall");
}
@Override
public final CallableStatement prepareCall(final String sql, final int resultSetType, final int resultSetConcurrency, final int resultSetHoldability) throws SQLException {
throw new SQLFeatureNotSupportedException("prepareCall");
}
@Override
public final String nativeSQL(final String sql) throws SQLException {
throw new SQLFeatureNotSupportedException("nativeSQL");
}
@Override
public final void abort(final Executor executor) throws SQLException {
throw new SQLFeatureNotSupportedException("abort");
}
@Override
public final Map<String, Class<?>> getTypeMap() throws SQLException {
throw new SQLFeatureNotSupportedException("getTypeMap");
}
@Override
public final void setTypeMap(final Map<String, Class<?>> map) throws SQLException {
throw new SQLFeatureNotSupportedException("setTypeMap");
}
@Override
public int getNetworkTimeout() throws SQLException {
throw new SQLFeatureNotSupportedException("getNetworkTimeout");
}
@OverrideView on GitHub (pinned to e952770a21)
Solutions
- Let the connection be closed normally with Connection.close(), which ShardingSphere fully supports, instead of abort().
- Configure the surrounding connection pool to use close()/isValid-based eviction rather than abort-based eviction.
- If a hard kill is truly required, close the underlying real connections obtained via unwrap(), accepting that ShardingSphere's metadata about them becomes stale.
Defensive patterns
Strategy: try-catch
Validate before calling
boolean supportsOp = false;
try {
connection.getMetaData(); // connection is alive
// JDBC has no capability flag for individual methods; probe once per JVM:
supportsOp = probeSupport(connection); // reflective/one-time guarded call
} catch (final SQLException ignored) {
}
// Simpler and recommended: capability-check by driver URL
boolean isShardingSphere = url.startsWith("jdbc:shardingsphere:");
if (isShardingSphere) {
// skip the unsupported call, use the alternative API path
} Try / catch
try {
connection.abort(/* args */);
} catch (final SQLFeatureNotSupportedException e) {
// expected on ShardingSphere connections: fall back to supported API
log.debug("Driver does not support abort, using fallback", e);
} Prevention
- Configure pool eviction to use close() and isValid(), never abort(), when the pool fronts a ShardingSphere DataSource.
- Check the JDBC URL before calling optional JDBC 4 methods: connections starting with jdbc:shardingsphere: never support the lob/network-timeout/client-info/callable APIs.
- Catch java.sql.SQLFeatureNotSupportedException (parent of ShardingSphere's UnsupportedSQLOperationException) around optional driver-capability calls so the application degrades gracefully.
When it happens
Trigger: Calling Connection.abort(executor) on a ShardingSphere connection, typically from a watchdog thread or a connection pool's abnormal-connection handling.
Common situations: JDBC-pool implementations (e.g. custom pools, UCP) that call abort() when cleaning up stuck connections; applications implementing their own connection timeouts; monitoring agents (JDBC wrappers, profilers) that probe abort support during startup.
Related errors
AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14).
Data as JSON: /api/errors/841258dbd37b88cb.
Report an issue: GitHub.