标签:获取 入门 otf 取数 oid com statement rman system
package com.itcast.jdbc; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; public class JdbcDemo1 { public static void main(String[] args) throws ClassNotFoundException, SQLException { // 1.注册驱动 Class.forName("com.mysql.jdbc.Driver"); // 2.获取数据库连接对象 Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/db1","root","root"); // 3.定义sql语句 String sql = "update student3 set math = 67 where id = 3"; // 4.获取执行sql的对象 Statement stmt = conn.createStatement(); // 5.执行sql int count = stmt.executeUpdate(sql); // 6.处理结果 System.out.println(count); //7.释放资源 stmt.close(); conn.close(); } }
标签:获取 入门 otf 取数 oid com statement rman system
原文地址:https://www.cnblogs.com/987m/p/12182517.html