Skip to content

Commit f08bfed

Browse files
committed
Oracle: Lightweight Connection Validation (#1451)
* Oracle: Lightweight Connection Validation See #1450 Signed-off-by: Thomas Segismont <[email protected]> * 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 <[email protected]> --------- Signed-off-by: Thomas Segismont <[email protected]>
1 parent abee647 commit f08bfed

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

vertx-oracle-client/src/main/java/io/vertx/oracleclient/impl/OracleJdbcConnection.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434

3535
public class OracleJdbcConnection implements Connection {
3636

37+
private static final Logger log = LoggerFactory.getLogger(OracleJdbcConnection.class);
38+
3739
private final ClientMetrics metrics;
3840
private final OracleConnection connection;
3941
private final OracleMetadata metadata;
@@ -104,7 +106,12 @@ public boolean isSsl() {
104106

105107
@Override
106108
public boolean isValid() {
107-
return true;
109+
try {
110+
return connection.isValid(OracleConnection.ConnectionValidation.NONE, 0);
111+
} catch (SQLException e) {
112+
log.trace("Failed to validate connection", e);
113+
return false;
114+
}
108115
}
109116

110117
@Override

0 commit comments

Comments
 (0)