import java.sql.*;
public class JDBC {
public static void main(String[] args) throws ClassNotFoundException, SQLException {
//加载驱动
Class.forName("com.mysql.jdbc.Driver");
//建立连接
Connection connection = DriverManager.getConnection
("jdbc:mysql://localhost:3306/chatroom?user=root&password=root");
//准备命令
Statement statement = connection.createStatement();
//执行SQL
String sql = "insert into user (userName ,passward,brief) value ('xi','123456fgh','美')";
//ResultSet resultSet= statement.executeQuery(sql);
int row = statement.executeUpdate(sql);
System.out.println(row);
statement.close();
connection.close();
}
}