Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
FlyingYu-Z committed Mar 31, 2021
1 parent 5d69bd5 commit 3b7601a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ maven { url 'https://jitpack.io' }

````aidl
Maven:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.23</version>
</dependency>
<dependency>
<groupId>com.github.FlyingYu-Z</groupId>
<artifactId>TableUpdater</artifactId>
Expand All @@ -28,6 +36,7 @@ Maven:
Gradle:
dependencies {
implementation 'com.github.FlyingYu-Z:TableUpdater:Tag'
implementation 'mysql:mysql-connector-java:8.0.23'
}
````
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.37</version>
<version>8.0.23</version>
<scope>runtime</scope>
</dependency>

Expand Down
25 changes: 13 additions & 12 deletions src/main/java/cn/beingyi/mysql/utils/JDBCUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,39 @@


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);
closeConnection(connection);
}


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);
Expand Down

0 comments on commit 3b7601a

Please sign in to comment.