1、加载驱动类

Class.forName(“”);

 

2、创建数据库连接

Connection con = DriverManager.getConnection(url, user, password);

 

3、创建Statement对象

Statement stat = con.createStatement();

 

4、数据库操作

stat.executeUpdate(“SQL更新语句”);

ResultSet rs = stat.execulteQuery(“SQL查询语句”);

 

5、关闭数据库连接

rs.close();

stat.close();

con.close();

相关文章:

  • 2021-11-17
  • 2022-12-23
  • 2021-12-22
  • 2021-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-03-02
  • 2021-12-18
  • 2021-11-07
  • 2021-10-28
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案