From 0fedc970654149aa21cdd581a1bbba4574cd1944 Mon Sep 17 00:00:00 2001 From: "shaojin.wensj" Date: Wed, 1 Feb 2023 16:21:34 +0800 Subject: [PATCH] fix oracle connection socket leak --- .../com/alibaba/druid/pool/DruidConnectionHolder.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/com/alibaba/druid/pool/DruidConnectionHolder.java b/core/src/main/java/com/alibaba/druid/pool/DruidConnectionHolder.java index 0a6cbb6ef8..dcb8a69b45 100644 --- a/core/src/main/java/com/alibaba/druid/pool/DruidConnectionHolder.java +++ b/core/src/main/java/com/alibaba/druid/pool/DruidConnectionHolder.java @@ -130,15 +130,16 @@ public final class DruidConnectionHolder { String connClassName = conClass.getName(); if ((!ORACLE_SOCKET_FIELD_ERROR) && connClassName.equals("oracle.jdbc.driver.T4CConnection")) { try { - if (ORACLE_FIELD_NT == null) { + if (ORACLE_FIELD_NET == null) { Field field = conClass.getDeclaredField("net"); field.setAccessible(true); - ORACLE_FIELD_NT = field; + ORACLE_FIELD_NET = field; } - Object net = ORACLE_FIELD_NT.get(conn); + Object net = ORACLE_FIELD_NET.get(conn); if (ORACLE_FIELD_S_ATTS == null) { - Field field = net.getClass().getDeclaredField("sAtts"); + // NSProtocol + Field field = net.getClass().getSuperclass().getDeclaredField("sAtts"); field.setAccessible(true); ORACLE_FIELD_S_ATTS = field; }