当前位置:网站首页>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();}}边栏推荐
猜你喜欢

Double queue implementation stack?Dual stack implementation queue?

Study Notes: The Return of Machine Learning

Collection of NFT tools

中缀转后缀、前缀表达式快速解决办法

Keepalived 高可用的三种路由方案

当奈飞的NFT忘记了Web2的业务安全

Short video SEO search operation customer acquisition system function introduction

bgp 聚合 反射器 联邦实验

How to find new potential projects?Tools recommended

如何优雅的消除系统重复代码
随机推荐
【无标题】
学习英语的网站与资料
JSP内置对象out对象的功能简介说明
Short video SEO optimization tutorial Self-media SEO optimization skills and methods
信息物理系统状态估计与传感器攻击检测
协作乐高 All In One:DAO工具大全
【Leetcode】470. Implement Rand10() Using Rand7()
基于超参数自动寻优的工控网络入侵检测
DOM 事件及事件委托
[头条]笔试题——最小栈
面试必问的HashCode技术内幕
Win11如何获得最佳电源效率?
CRS 管理与维护
EasyExcel的简单读取操作
【三子棋】C语言实现简易三子棋
C语言七夕来袭!是时候展现专属于程序员的浪漫了!
GIF making - very simple one-click animation tool
控制电机的几种控制电路原理图
基于数据驱动的变电站巡检机器人自抗扰控制
JSP out.write()方法具有什么功能呢?