当我试图关闭 JDBC 时,它正在抛出NullPointerException
.
public void getDBConnection() throws SQLException {
Driver driver = new Driver();
DriverManager.registerDriver(driver);
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root123");
}
public void closeDB() throws SQLException {
conn.close();
}