当前位置:网站首页>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();}}边栏推荐
猜你喜欢
随机推荐
Async/await principle and execution sequence analysis
众筹DAO“枯萎”的缩影:曾拍下《沙丘》未出版手稿的Spice DAO解散
IO流基础
A simple file transfer tools
Using the "stack" fast computing -- reverse polish expression
Statement执行update语句
【Leetcode】479. Largest Palindrome Product
不就是个TCC分布式事务,有那么难吗?
security CSRF Vulnerability Protection
QML包管理
路由策略
security CSRF漏洞保护
els 长条变形
security cross-domain configuration
Short video SEO search operation customer acquisition system function introduction
LeetCode_322_零钱兑换
图解LeetCode——1161. 最大层内元素和(难度:中等)
REST会消失吗?事件驱动架构如何搭建?
零基础如何学习单片机,一位入门者的进阶路径,可参考
08-SDRAM:汇总









