JDBC
1. JDBC 的用途 - 插入数据操作
2、JDBC 的含义:
JDBC 即为 Java 连接数据库的桥梁(一套规范)
使用步骤:
- 加载驱动:
Class.forName("com.mysql.cj.jdbc.Driver");
- 获取连接:
String url、username、password
Connection connection = DriverManager.getConnection(url,un,psw);
- 创建对话:
Statement sta = connection.createStatement();
- 发送 SQL:
ResultSet resultSet = sta.executeQuery("select * from ~");
- 遍历 resultSet: