code: public int execSelectCount(String preparedSql, Object[] searchKeys) {
      log("#execSelectCount preparedSql=" + preparedSql + " searchKeys=" + searchKeys);
      int retVal = 0;
  
      PreparedStatement preparedStmt = null;
      ResultSet rs = null;
  
      final Connection conn = createConnection();
  
      try {
  
        preparedStmt = conn.prepareStatement(preparedSql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
  
        final StringBuilder logSb = new StringBuilder();
  
        if (searchKeys != null) {
          logSb.append("/ ");
          for (int i = 0; i < searchKeys.length; i++) {
  
            setObject((i + 1), preparedStmt, searchKeys[i]);
  
            logSb.append("key(" + (i + 1) + ")=" + searchKeys[i]);
            logSb.append(" ");
          }
        }
  
        log("#execSelectCount SQL=" + preparedSql + " " + logSb.toString());
  
        // execute SQL
        rs = preparedStmt.executeQuery();
  
        while (rs.next()) {
          retVal = rs.getInt(1);
        }
  
      } catch (Exception e) {
        loge("#execSelectCount", e);
  
      } finally {
        try {
          if (rs != null) {
            rs.close();
          }
          if (preparedStmt != null) {
            preparedStmt.close();
          }
          if (conn != null) {
            conn.close();
          }
        } catch (SQLException e) {
  
          loge("#execSelectCount", e);
        }
      }
      return retVal;
  
    }
docs: Execute the SQL for number search<br>
  
  @param preparedSql
  @param searchKeys
  @return number of result