当前位置:网站首页>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();}}
边栏推荐
- Short video SEO search operation customer acquisition system function introduction
- Excel表格数据导入MySQL数据库
- 信息物理系统状态估计与传感器攻击检测
- Win11内存管理错误怎么办?
- 利用“栈”快速计算——逆波兰表达式
- easy-excel 解决百万数据导入导出,性能很强
- DVWA靶场环境搭建
- Excel文件读写(创建与解析)
- 电机原理动图合集
- After an incomplete recovery, the control file has been created or restored, the database must be opened with RESETLOGS, interpreting RESETLOGS.
猜你喜欢
Double queue implementation stack?Dual stack implementation queue?
Excel导入和导出
Short video SEO optimization tutorial Self-media SEO optimization skills and methods
How to get the best power efficiency in Windows 11?
Win11内存管理错误怎么办?
22.支持向量机—高斯核函数
协作乐高 All In One:DAO工具大全
Task execution control in Ansible
使用 Zadig 交付云原生微服务应用
REST会消失吗?事件驱动架构如何搭建?
随机推荐
C语言七夕来袭!是时候展现专属于程序员的浪漫了!
How to design a circular queue?Come and learn~
【ACWing】406. 放置机器人
【Leetcode】470. Implement Rand10() Using Rand7()
Excel表格数据导入MySQL数据库
信息物理系统状态估计与传感器攻击检测
基于超参数自动寻优的工控网络入侵检测
Using the "stack" fast computing -- reverse polish expression
不了解SynchronousQueue?那ArrayBlockingQueue和LinkedBlockingQueue不会也不知道吧?
IP Core: FIFO
【21天学习挑战赛】顺序查找和二分查找的小总结
Short video SEO optimization tutorial Self-media SEO optimization skills and methods
重装腾讯云云监控后如果对应服务不存在可通过sc.exe命令添加服务
JSP request对象功能详解说明
JSP 如何获取request对象中的路径信息呢?
07-SDRAM: FIFO control module
控制电机的几种控制电路原理图
security CSRF Vulnerability Protection
QML包管理
bgp 聚合 反射器 联邦实验