当前位置:网站首页>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();}}
边栏推荐
猜你喜欢
随机推荐
JSP out.print()和out.write()方法的不同之处
基于超参数自动寻优的工控网络入侵检测
06-SDRAM :SDRAM控制模块
如何重装Win11?一键重装Win11方法
easy-excel 解决百万数据导入导出,性能很强
els strip deformation
Multi-feature fusion face detection based on attention mechanism
go语言标准库fmt包怎么使用
信息物理系统状态估计与传感器攻击检测
一文概览最实用的 DeFi 工具
使用 Zadig 交付云原生微服务应用
【Leetcode】479. Largest Palindrome Product
NFT工具合集
C language Qixi is coming!It's time to show the romance of programmers!
学习英语的网站与资料
[Headline] Written test questions - minimum stack
学习笔记:机器学习之回归
Short video SEO search operation customer acquisition system function introduction
How to solve the error when mysql8 installs make
How to get the best power efficiency in Windows 11?