Package org.apache.commons.dbutils

Examples of org.apache.commons.dbutils.QueryRunner


   */
  public void createUser(String userName, String password)
    throws ControllerException {
   
    String sql = "create user " + userName + " set password '" + password + "'";
    QueryRunner queryRunner = new QueryRunner(DataSourceHandler.getDataSource());
   
    try {
     
      queryRunner.update(sql);
    } catch (SQLException se) {
      log.warning("SystemDBController: " + se.getMessage());
      throw new ControllerException(se);
    }
  }     
View Full Code Here


      sql += " set acount lock";
    } else {
      sql += " set acount unlock";
    }
     
    QueryRunner queryRunner = new QueryRunner(DataSourceHandler.getDataSource());
    ResultSetHandler rsh = new MapHandler();
    try {
      queryRunner.update(sql);
    } catch (SQLException se) {
      log.warning("SystemDBController: " + se.getMessage());
      throw new ControllerException(se);
    }
  }     
View Full Code Here

   
    if (groupList != null) {
      sql += " set groups '" + groupList +"'";
    }
   
    QueryRunner queryRunner = new QueryRunner(DataSourceHandler.getDataSource());
    ResultSetHandler rsh = new MapHandler();
    try {
      queryRunner.update(sql);
    } catch (SQLException se) {
      log.warning("SystemDBController: " + se.getMessage());
      throw new ControllerException(se);
    }
  }     
View Full Code Here

   */
  public void dropUser(String userName)
    throws ControllerException {
   
    String sql = "drop user " + userName;
    QueryRunner queryRunner = new QueryRunner(DataSourceHandler.getDataSource());
    try {
      queryRunner.update(sql);
    } catch (SQLException se) {
      log.warning("SystemDBController: " + se.getMessage());
      throw new ControllerException(se);
    }
  }
View Full Code Here

    } catch (SQLException se) {
      System.out.println(se.getMessage());
      return;
    }
   
    QueryRunner runner = new QueryRunner();
    ResultSetHandler rsh = new MapHandler();
    String sql = null;
    Map clientMap = null;
    Object obj = null;
   
    try {
      sql = "delete from Client where (ClientID=40)";
      obj = runner.query(conn, sql, null, rsh);
    } catch (SQLException se) {
      System.out.println(se.getMessage());
      return;
    }
   
    try {
      sql = "select * from Client where (ClientID=40)";
      clientMap = (Map) runner.query(conn, sql, null, rsh);
      DbUtils.close(conn);
    } catch (SQLException se) {
      System.out.println(se.getMessage());
      return;
    }
View Full Code Here

   */
  public static JSONArray getList(String sql, Object... params) {
    Connection con=DBPool.getConnection();
    final JSONArray jsonArr = new JSONArray();
    try {
      QueryRunner runner = new QueryRunner();
      runner.query(con,sql.toString(), new ResultSetHandler<Object>() {
        public Object handle(ResultSet rs) throws SQLException {
          ResultSetMetaData metaData = rs.getMetaData();
          int cols = metaData.getColumnCount();
          while (rs.next()) {
            JSONObject jsonObj = new JSONObject();
View Full Code Here

   * @return
   */
  public static int update(String sql, Object... params) {
    Connection con=DBPool.getConnection();
    try {
      QueryRunner runner = new QueryRunner();
      return runner.update(con,sql, params);
    } catch (Exception e) {
      log.error(e.getMessage(), e);
    }finally{
      DBPool.releaseConnection(con);
    }
View Full Code Here

    sql.append("SELECT * FROM schritte WHERE ProzesseID = ?");
    sql.append(" ORDER BY Reihenfolge ASC");
    try {
      Object[] params = { processId };
      logger.debug(sql.toString() + ", " + processId);
      List<StepObject> ret = new QueryRunner().query(connection, sql.toString(), MySQLUtils.resultSetToStepObjectListHandler, params);
      // (connection, stmt, MySQLUtils.resultSetToStepObjectListHandler);
      return ret;
    } finally {
      closeConnection(connection);
    }
View Full Code Here

    sql.append("SELECT * FROM prozesseeigenschaften WHERE prozesseID = ?");

    try {
      Object[] params = { processId };
      logger.debug(sql.toString() + ", " + processId);
      List<Property> answer = new QueryRunner().query(connection, sql.toString(), MySQLUtils.resultSetToProcessPropertyListHandler, params);
      return answer;
    } finally {
      closeConnection(connection);
    }
  }
View Full Code Here

    StringBuilder sql = new StringBuilder();
    sql.append("SELECT * FROM vorlageneigenschaften WHERE vorlageneigenschaften.vorlagenID = (SELECT VorlagenID FROM vorlagen WHERE ProzesseID = ?)");
    try {
      Object[] params = { processId };
      logger.debug(sql.toString() + ", " + processId);
      List<Property> answer = new QueryRunner().query(connection, sql.toString(), MySQLUtils.resultSetToTemplatePropertyListHandler, params);
      return answer;
    } finally {
      closeConnection(connection);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.commons.dbutils.QueryRunner

Copyright © 2018 www.massapicom. 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.