📄 statementcreate.java
字号:
/* * StatementCreate.java * * Created on June 9, 2005, 3:47 PM * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */package ch01;import java.sql.*;import javax.sql.*;import common.*;/** * * @author kevin */public class StatementCreate { /** Creates a new instance of StatementCreate */ public StatementCreate() { } public static void main(String[] args){ Connection conn = null; Statement stmt = null; try{ ConnectionFactory factory = ConnectionFactory.getConnectionFactory(); conn = factory.getConnection(); stmt = conn.createStatement(); int number = stmt.executeUpdate("insert into simple_tbl (id, name) values (100, \'kevin\')"); System.out.println("insert record: " + number); number = stmt.executeUpdate("update simple_tbl set id = 400 where id = 100"); System.out.println("update record: " + number); number = stmt.executeUpdate("delete from simple_tbl where id=400"); System.out.println("delete record: " + number); }catch(Exception e){ e.printStackTrace(); }finally{ DBUtils.close(stmt, conn); } } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -