zoukankan      html  css  js  c++  java
  • ApacheDbUtilsUpdate

    ApacheDbUtilsUpdate
    package p1;
    
    import com.DataSourceUtil;
    import org.apache.commons.dbutils.QueryRunner;
    
    public class ApacheDbUtilsUpdate {
        public static void main(String[] args) throws Exception {
            // add();
            // update();
            delete();
        }
    
        public static int add() throws Exception {
            QueryRunner queryRunner = new QueryRunner(DataSourceUtil.getDataSourceC3p0());
            String sql = "insert into student values(?,?)";
            return queryRunner.update(sql, "4", "zl");
        }
    
        public static int update() throws Exception {
            QueryRunner queryRunner = new QueryRunner(DataSourceUtil.getDataSourceC3p0());
            String sql = "update student set name=? where id=?";
            return queryRunner.update(sql, "xx", "4");
        }
    
        public static int delete() throws Exception {
            QueryRunner queryRunner = new QueryRunner(DataSourceUtil.getDataSourceC3p0());
            String sql = "delete from student where id=?";
            return queryRunner.update(sql, "4");
        }
    
    }
  • 相关阅读:
    5.16欢乐赛
    卢卡斯定理
    noip2017 宝藏
    [JSOI2009]计数问题
    HDU 1160 FatMouse's Speed
    HDU 1260 Tickets
    HDU 1176 免费馅饼
    HDU 1114 Piggy-Bank
    HDU 1074 Doing Homework
    HDU 1069 Monkey and Banana
  • 原文地址:https://www.cnblogs.com/kikyoqiang/p/11788942.html
Copyright © 2011-2022 走看看