数据库常用懒得打代码备份
1 import java.sql.Connection; 2 import java.sql.DriverManager; 3 import java.sql.Statement; 4 public class ******* { 5 public static final String DBDRIVER = "com.mysql.jdbc.Driver"; 6 public static final String DBURL = "jdbc:mysql://localhost:3306/test"; 7 public static final String DBUSER ="root"; 8 public static final String DBPASS ="123456"; 9 public static void main(String[] args) throws Exception{ 10 Connection conn=null; 11 Statement stmt=null; 12 13 14 } 15 }
INSERT INTO newbook (password,age,sex,name,hobby) VALUES ('123456',18,'男','小萌萌','WOT');
UPDATE newbook SET name='"+name+"',password='"+password+"',age="+age+",sex='"+sex+"',hobby='"+hobby+"'where id="+id;