diff --git a/README.md b/README.md
index 14b62d4..c5d2eb3 100644
--- a/README.md
+++ b/README.md
@@ -15,6 +15,14 @@ maven { url 'https://jitpack.io' }
````aidl
Maven:
+
+
+
+ mysql
+ mysql-connector-java
+ 8.0.23
+
+
com.github.FlyingYu-Z
TableUpdater
@@ -28,6 +36,7 @@ Maven:
Gradle:
dependencies {
implementation 'com.github.FlyingYu-Z:TableUpdater:Tag'
+ implementation 'mysql:mysql-connector-java:8.0.23'
}
````
diff --git a/pom.xml b/pom.xml
index 90ffb04..e29233d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,7 +16,7 @@
mysql
mysql-connector-java
- 5.1.37
+ 8.0.23
runtime
diff --git a/src/main/java/cn/beingyi/mysql/utils/JDBCUtils.java b/src/main/java/cn/beingyi/mysql/utils/JDBCUtils.java
index dff64b6..8f7d782 100644
--- a/src/main/java/cn/beingyi/mysql/utils/JDBCUtils.java
+++ b/src/main/java/cn/beingyi/mysql/utils/JDBCUtils.java
@@ -6,26 +6,27 @@
public class JDBCUtils {
-
+
static {
try {
- Class.forName("com.mysql.jdbc.Driver");
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
+ Class.forName("com.mysql.cj.jdbc.Driver");
+ } catch (ClassNotFoundException classNotFoundException) {
+ classNotFoundException.printStackTrace();
try {
- Class.forName("com.mysql.cj.jdbc.Driver");
- } catch (ClassNotFoundException classNotFoundException) {
- classNotFoundException.printStackTrace();
+ Class.forName("com.mysql.jdbc.Driver");
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+
}
}
}
-
+
public static Connection getConnection(ReadyCore readyCore) throws Exception {
Connection connection = DriverManager.getConnection(readyCore.getReady().getDbUrl(), readyCore.getReady().getUserName(), readyCore.getReady().getPassWord());
return connection;
}
-
-
+
+
public static void closeResource(ResultSet resultSet, Statement statement, Connection connection) {
closeResultSet(resultSet);
closeStatement(statement);
@@ -33,11 +34,11 @@ public static void closeResource(ResultSet resultSet, Statement statement, Conne
}
- public static void closeResource(ResultSet resultSet,Statement statement) {
+ public static void closeResource(ResultSet resultSet, Statement statement) {
closeResultSet(resultSet);
closeStatement(statement);
}
-
+
public static void closeResource(Statement statement, Connection connection) {
closeStatement(statement);
closeConnection(connection);