Package com.mysql.jdbc

Examples of com.mysql.jdbc.Statement.executeUpdate()


        System.out.println( sqlStatement );

        try {
            Statement stmt = ( Statement ) connection.getConnection().createStatement();
            affectedRows = stmt.executeUpdate( sqlStatement );
        } catch( SQLException e ) {
            System.out.println( e.getMessage() );
            throw new RuntimeException();
        }
View Full Code Here


  }
 
  private void executeQuery(String query){
    try {
      Statement state = (Statement) con.createStatement();
      state.executeUpdate(query);
     
      state.close();
    } catch (SQLException e) {
      e.printStackTrace();
    }
View Full Code Here

  public  boolean excSql(String sql) { 
  if(con == null)getConnection(); //连接到数据库  
 
     try
        Statement st = (Statement) con.createStatement();    // 创建用于执行静态sql语句的Statement对象  
           int counts=st.executeUpdate(sql)// 执行操作的sql语句  
           if (0==counts) {
          log.info("执行成功,,共0条数据受到影响,没有完成操作!:SQL语句-->【"+sql+"】");
      return false;
           }
           log.info("执行成功,共"+counts+"条数据受到影响:"+"SQL语句-->【"+sql+"】");
View Full Code Here

    if (con == null)
      getConnection(); // 连接到数据库

    try {
      Statement st = (Statement) con.createStatement(); // 创建用于执行静态sql语句的Statement对象
      int counts = st.executeUpdate(sql); // 执行操作的sql语句
      if (0 == counts) {
        log.info("执行成功,,共0条数据受到影响,没有完成操作!:SQL语句-->【" + sql + "】");
        return false;
      }
      log.info("执行成功,共" + counts + "条数据受到影响:" + "SQL语句-->【" + sql + "】");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.