当前位置:网站首页>The Statement update Statement execution
The Statement update Statement execution
2022-08-02 00:18:00 【Camellia——】
package com.lin.jdbc_01;import java.sql.Connection;import java.sql.DriverManager;import java.sql.Statement;/** Use Statement to operate DML, updata statement* */public class JdbcDemo1 {public static void main(String[] args) throws Exception {//1) Register the driverClass.forName("com.mysql.jdbc.Driver");// 2) Get the database connection objectConnection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb_01", "root", "123456");// 3) Prepare sqlString sql="update stu set name='Wang Wu' where id=4;";// 4) Create an execution objectStatement stmt=conn.createStatement();// 5) executeint count=stmt.executeUpdate(sql);System.out.println(count);// 6) Release resourcesstmt.close();conn.close();}}边栏推荐
猜你喜欢
随机推荐
不了解SynchronousQueue?那ArrayBlockingQueue和LinkedBlockingQueue不会也不知道吧?
els 方块变形
扑克牌问题
【Leetcode】470. Implement Rand10() Using Rand7()
els 方块变形判断。
Don't know about SynchronousQueue?So ArrayBlockingQueue and LinkedBlockingQueue don't and don't know?
JSP request对象功能详解说明
mysql8安装make报错如何解决
EasyExcel的简单读取操作
ES中SQL查询详解
Excel文件读写(创建与解析)
短视频seo搜索优化主要内容
2022/08/01 学习笔记 (day21) 泛型和枚举
[Headline] Written test questions - minimum stack
信息物理系统状态估计与传感器攻击检测
How to design a circular queue?Come and learn~
【无标题】
Play NFT summer: this collection of tools is worth collecting
How to get the best power efficiency in Windows 11?
JSP 如何获取request对象中的路径信息呢?








