Package org.apache.commons.dbutils

Examples of org.apache.commons.dbutils.QueryRunner.query()


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


      System.out.println("Field value = " + clientMap.get(fieldName));
    }
   
    clientMap = null;
    try {
      clientMap = (Map) runner.query(conn, sql, null, rsh);
      DbUtils.close(conn);
    } catch (SQLException se) {
      System.out.println(se.getMessage());
      return;
    }
View Full Code Here

    sql += " where (UserName='" + userName + "')";
    QueryRunner queryRunner = new QueryRunner(DataSourceHandler.getDataSource());
    ResultSetHandler rsh = new MapHandler();

    try {
      return (Map) queryRunner.query(sql, rsh);
    } catch (SQLException se) {
      log.warning("SystemDBController: " + se.getMessage());
      throw new ControllerException(se);
    }
  }     
View Full Code Here

      QueryRunner queryRunner = new QueryRunner(DataSourceHandler.getDataSource());
      ResultSetHandler rsh = new MapListHandler();
      String sql = "select * from parameter";
     
      try {
        parameterMap = (Map) queryRunner.query(sql, rsh);
      } catch (SQLException se) {
        String msg = "Parameter: error loading parameters.\n" + se.getMessage();
        log.warning(msg);
        Messager.exception(null, msg);
        return;
View Full Code Here

    QueryRunner runner = new QueryRunner(dataSource);
    ResultSetHandler rsh = new ResultSetMetaDataHandler();
    String sql = "select * from Client";
    List columnList = null;
    try {
      columnList = (List) runner.query(sql, rsh);
    } catch (SQLException se) {
      System.out.println(se.getMessage());
      return;
    }
   
View Full Code Here

      if (orderClause != null) {
        sql += " ORDER BY " + orderClause;
      }

      return (List) queryRunner.query(sql, rsh);
    } catch (SQLException se) {
      log.warning("GenericController SQLException: " + se.getMessage());
      throw new ControllerException(se);
    }
  }
View Full Code Here

      if (whereClause != null) {
        sql += " WHERE " + whereClause;
      }

      Map map = (Map) queryRunner.query(sql, rsh);
      if (map == null) {
        throw new FinderException();
      }

      return map;
View Full Code Here

        sql += " WHERE (" + whereClause + ")";
      }

      Map map = null;
      if (params == null) {
        map = (Map) queryRunner.query(sql, rsh);
      } else {
        map = (Map) queryRunner.query(sql, params, rsh);
      }

      if (map == null) {
View Full Code Here

      Map map = null;
      if (params == null) {
        map = (Map) queryRunner.query(sql, rsh);
      } else {
        map = (Map) queryRunner.query(sql, params, rsh);
      }

      if (map == null) {
        return false;
      } else {
View Full Code Here

      conn.setAutoCommit(false); // Start transaction

      sql = "select * from " + tableName;
      sql += " where (" + primaryKeyName + "=?)";
      Map columnMapTemp =
        (Map) queryRunner.query(
          sql,
          columnMap.get(primaryKeyName),
          rsh);

      if (columnMapTemp == null) {
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.