Skip to content

Commit a24b668

Browse files
authored
更新 SQLite.java
1 parent 4b40a33 commit a24b668

File tree

1 file changed

+5
-9
lines changed
  • src/main/java/cc/baka9/catseedlogin/bukkit/database

1 file changed

+5
-9
lines changed

src/main/java/cc/baka9/catseedlogin/bukkit/database/SQLite.java

+5-9
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public SQLite(JavaPlugin plugin) {
1212
super(plugin);
1313
}
1414

15-
public Connection getConnection() {
15+
public Connection getConnection() throws ClassNotFoundException, SQLException {
1616
if (this.connection != null && !this.connection.isClosed()) {
1717
return this.connection;
1818
}
@@ -22,14 +22,10 @@ public Connection getConnection() {
2222
plugin.getDataFolder().mkdir();
2323
}
2424

25-
try {
26-
// 加载SQLite的JDBC驱动
27-
Class.forName("org.sqlite.JDBC");
28-
// 创建数据库连接
29-
this.connection = DriverManager.getConnection("jdbc:sqlite:" + plugin.getDataFolder().getAbsolutePath() + "/accounts.db");
30-
} catch (ClassNotFoundException | SQLException e) {
31-
e.printStackTrace();
32-
}
25+
// 加载SQLite的JDBC驱动
26+
Class.forName("org.sqlite.JDBC");
27+
// 创建数据库连接
28+
this.connection = DriverManager.getConnection("jdbc:sqlite:" + plugin.getDataFolder().getAbsolutePath() + "/accounts.db");
3329

3430
return this.connection;
3531
}

0 commit comments

Comments
 (0)