package com.yanyu;import java.sql.*;
import java.util.ResourceBundle;public class UpdateUser {public static void main(String[] args) {ResourceBundle bundle = ResourceBundle.getBundle("db//mydata");String driver = bundle.getString("driver");String url = bundle.getString("url");String user = bundle.getString("user");String password = bundle.getString("password");Connection con = null;Statement st = null;ResultSet rs = null;try {Class.forName(driver);con = DriverManager.getConnection(url,user,password);
String sql = "delete from user";st = con.createStatement();st.execute(sql);} catch (ClassNotFoundException e) {throw new RuntimeException(e);} catch (SQLException e) {throw new RuntimeException(e);} finally {if (rs != null) {try {rs.close();} catch (SQLException e) {throw new RuntimeException(e);}}if (st != null) {try {st.close();} catch (SQLException e) {throw new RuntimeException(e);}}if (con != null) {try {con.close();} catch (SQLException e) {throw new RuntimeException(e);}}}}
}
driver=com.mysql.cj.jdbc.Driver
url=jdbc:mysql:
user=root
password=123456