From a9ab1321f2d19d915ffc5c76b90b382283cb4ca2 Mon Sep 17 00:00:00 2001 From: rinoux Date: Fri, 6 May 2022 11:36:22 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-70827=20&=20REPORT-70810=20=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E6=80=A7=E9=97=AE=E9=A2=982?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hibernate/DruidConnectionProvider.java | 18 ++++-------------- .../third/alibaba/druid/util/MySqlUtils.java | 2 +- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/fine-druid/src/main/java/com/fr/third/alibaba/druid/support/hibernate/DruidConnectionProvider.java b/fine-druid/src/main/java/com/fr/third/alibaba/druid/support/hibernate/DruidConnectionProvider.java index 86f51bf0b..d760f9dd0 100644 --- a/fine-druid/src/main/java/com/fr/third/alibaba/druid/support/hibernate/DruidConnectionProvider.java +++ b/fine-druid/src/main/java/com/fr/third/alibaba/druid/support/hibernate/DruidConnectionProvider.java @@ -18,22 +18,20 @@ package com.fr.third.alibaba.druid.support.hibernate; import java.sql.Connection; import java.sql.SQLException; import java.util.Map; -import java.util.Properties; import com.fr.third.alibaba.druid.pool.DruidDataSource; import com.fr.third.alibaba.druid.pool.DruidDataSourceFactory; -import com.fr.third.org.hibernate.HibernateException; import com.fr.third.org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; -import com.fr.third.org.hibernate.exception.spi.Configurable; +import com.fr.third.org.hibernate.service.spi.Configurable; import com.fr.third.org.hibernate.service.spi.Stoppable; public class DruidConnectionProvider implements ConnectionProvider, Configurable, Stoppable { private static final long serialVersionUID = 1026193803901107651L; - private DruidDataSource dataSource; + private DruidDataSource dataSource; - public DruidConnectionProvider(){ + public DruidConnectionProvider() { dataSource = new DruidDataSource(); } @@ -64,7 +62,7 @@ public class DruidConnectionProvider implements ConnectionProvider, Configurable } @SuppressWarnings("rawtypes") - //@Override + @Override public void configure(Map configurationValues) { try { DruidDataSourceFactory.config(dataSource, configurationValues); @@ -78,12 +76,4 @@ public class DruidConnectionProvider implements ConnectionProvider, Configurable dataSource.close(); } - @Override - public void configure(Properties properties) throws HibernateException { - try { - DruidDataSourceFactory.config(dataSource, properties); - } catch (SQLException e) { - throw new IllegalArgumentException("config error", e); - } - } } diff --git a/fine-druid/src/main/java/com/fr/third/alibaba/druid/util/MySqlUtils.java b/fine-druid/src/main/java/com/fr/third/alibaba/druid/util/MySqlUtils.java index ad13c1bc4..c5523d370 100644 --- a/fine-druid/src/main/java/com/fr/third/alibaba/druid/util/MySqlUtils.java +++ b/fine-druid/src/main/java/com/fr/third/alibaba/druid/util/MySqlUtils.java @@ -415,7 +415,7 @@ public class MySqlUtils { if (cc.class_connectionImpl == null && !cc.class_connectionImpl_Error) { try { cc.class_connectionImpl = Utils.loadClass("com.mysql.jdbc.MySQLConnection"); - if (cc.class_connectionImpl == null) { + if (cc.class_connectionImpl == null || cc.class_connectionImpl.getClassLoader() != cl) { cc.class_connectionImpl = Utils.loadClass("com.mysql.cj.MysqlConnection"); if (cc.class_connectionImpl != null) { cc.mysqlJdbcVersion6 = true;