Statement statement = con.createStatement();
//insert语句
String savesql = "insert into sys_user values('" + name + "','"
+ passw + "')";
statement.execute(savesql);
//select语句
String sql = "select * from sys_user";
statement.executeQuery(sql);
注意:insert,update语句的时候,需要使用statement.execute(sql);若使用statement.executeQuery(sql);会报异常如下:
Can not issue data manipulation statements with executeQuery()
......