jdbc增删改操作
import javax.xml.transform.Result;
import java.sql.*;
public class firstjdbc {
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Class.forName("com.mysql.cj.jdbc.Driver");
String url ="jdbc:mysql://localhost:3306/school";
String username="root";
String pasword="123456";
Connection connection = DriverManager.getConnection(url, username, pasword);
Statement statement = connection.createStatement();
String sql="INSERT INTO student VALUES(6,"李四",3)";
statement.executeUpdate(sql);
statement.executeUpdate(sql);
statement.close();
connection.close();
}
}