Skip to content

Commit

Permalink
Oracle: Lightweight Connection Validation (#1451)
Browse files Browse the repository at this point in the history
* Oracle: Lightweight Connection Validation

See #1450

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>

* Use NONE Connection validation.

This setting does not make the driver block and is implemented as a simple lifecycle check.

This is exactly what we do with other clients (Pg, MySQL, ...etc).

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>

---------

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
  • Loading branch information
tsegismont committed Aug 21, 2024
1 parent abee647 commit f08bfed
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

public class OracleJdbcConnection implements Connection {

private static final Logger log = LoggerFactory.getLogger(OracleJdbcConnection.class);

private final ClientMetrics metrics;
private final OracleConnection connection;
private final OracleMetadata metadata;
Expand Down Expand Up @@ -104,7 +106,12 @@ public boolean isSsl() {

@Override
public boolean isValid() {
return true;
try {
return connection.isValid(OracleConnection.ConnectionValidation.NONE, 0);
} catch (SQLException e) {
log.trace("Failed to validate connection", e);
return false;
}
}

@Override
Expand Down

0 comments on commit f08bfed

Please sign in to comment.