【JDBC】与eclipse中接合

来源:互联网 发布:网络逃犯查询 编辑:程序博客网 时间:2024/05/17 07:13

在eclipse中查看数据库中数据,使用Data Source Explorer  -> Schemas - > dbo -> tables  -> sample contents 


为了检测 SQL 语句的正确性,可以先把它输出,在数据库中执行


PreparedStatement 灵活指定 SQL中的变量

run configuration 输入 Arguments  

int deptno = Integer.parseInt(args[0]);String dname = args[1];String loc = args[2];

pstmt = conn.prepareStatement("insert into dept2 values (?, ?, ?)");pstmt.setInt(1, deptno);pstmt.setString(2, dname);pstmt.setString(3, loc);pstmt.executeUpdate();



0 0
原创粉丝点击