/** erstellt die nötigen Tabellen in der Datenbank, falls sie noch nicht exisiteren */
  private void erstelleTabellen() {
    try {
      // erstellt die Benutzer-Tabelle
      String dbQuery =
          "CREATE TABLE IF NOT EXISTS benutzer ("
              + "bNr INTEGER PRIMARY KEY AUTOINCREMENT,"
              + "benutzername VARCHAR(45) NOT NULL,"
              + "statusnachricht text,"
              + "statussymbol VARCHAR(4),"
              + "status_aktuell_seit INTEGER,"
              + "passwort VARCHAR(50) NOT NULL,"
              + "online TINYINT(1));";

      con.createStatement().executeUpdate(dbQuery);

      // erstellt die Kontaklisten-Tabelle
      dbQuery =
          "CREATE TABLE IF NOT EXISTS kontaktliste ("
              + "kId INTEGER PRIMARY KEY AUTOINCREMENT,"
              + "besitzer INTEGER,"
              + "kontakt INTEGER,"
              + "foreign key (besitzer) references benutzer(bNr),"
              + "foreign key (kontakt) references benutzer(bNr))";

      con.createStatement().executeUpdate(dbQuery);

    } catch (SQLException e) {
      System.err.println(e.getClass().getName() + ": " + e.getMessage());
      System.exit(1);
    }
  }
  /**
   * fügt einen neuen Kontakt zur Kontaktliste hinzu
   *
   * @param besitzer Der Besitzer der Kontaktliste
   * @param kontakt Der Kontakt, der hinzugefügt werden soll
   */
  public void kontaktZurKontaktListeHinzufuegen(String besitzer, String kontakt) {
    int kNr = bestimmeBNrBenutzer(kontakt);
    int bNr = bestimmeBNrBenutzer(besitzer);

    try {
      // überprüft, ob der Konktakt noch nicht in der Kontaktliste ist
      boolean gefunden = false;
      ResultSet rueckgabewert = null;
      String query1 = "select count(*) from kontaktliste where besitzer = ? and kontakt = ?";
      PreparedStatement anweisung1 = con.prepareStatement(query1);

      anweisung1.setString(1, besitzer);
      anweisung1.setString(1, kontakt);
      rueckgabewert = anweisung1.executeQuery();

      // werdet den Rückgabewert aus
      while (rueckgabewert.next()) {
        gefunden = rueckgabewert.getBoolean(1);
      }

      if (!gefunden) {
        // fügt den Kontakt zur Kontakliste hinzu
        String query = "insert into kontaktliste (besitzer, kontakt) values(?, ?);";
        PreparedStatement anweisung = con.prepareStatement(query);

        anweisung.setInt(1, bNr);
        anweisung.setInt(2, kNr);
        anweisung.executeUpdate();
      }
    } catch (SQLException e) {
      System.err.println(e.getClass().getName() + ": " + e.getMessage());
      System.exit(1);
    }
  }
Exemplo n.º 3
0
 @Override
 public void destroy() {
   if (stmt != null) {
     try {
       stmt.close();
     } catch (SQLException e2) {
       errormanager.printerror(e2.getClass().getName() + ": " + e2.getMessage());
     }
   }
   if (conn != null) {
     try {
       conn.close();
     } catch (SQLException e2) {
       errormanager.printerror(e2.getClass().getName() + ": " + e2.getMessage());
     }
   }
 }
Exemplo n.º 4
0
  public void testPooledConnectionWithProperties() throws SQLException {
    Util.PropertyList properties = TestContext.instance().getConnectionProperties().clone();

    // Only the JDBC-ODBC bridge gives the error necessary for this
    // test to succeed. So trivially succeed for all other JDBC
    // drivers.
    final String jdbc = properties.get("Jdbc");
    if (jdbc != null && !jdbc.startsWith("jdbc:odbc:")) {
      return;
    }

    // JDBC-ODBC driver does not support UTF-16, so this test succeeds
    // because creating the connection from the DataSource will fail.
    properties.put("jdbc.charSet", "UTF-16");

    final StringBuilder buf = new StringBuilder();
    DataSource dataSource = RolapConnection.createDataSource(null, properties, buf);
    final String desc = buf.toString();
    assertTrue(desc.startsWith("Jdbc="));

    Connection connection;
    try {
      connection = dataSource.getConnection();
      connection.close();
      fail("Expected exception");
    } catch (SQLException e) {
      if (e.getClass().getName().equals("org.apache.commons.dbcp.DbcpException")) {
        // This is expected. (We use string-comparison so that the
        // compiler doesn't warn about using a deprecated class.)
      } else if (e.getClass() == SQLException.class
          && e.getCause() == null
          && e.getMessage() != null
          && e.getMessage().equals("")) {
        // This is expected, from a later version of Dbcp.
      } else {
        fail("Expected exception, but got a different one: " + e);
      }
    } catch (IllegalArgumentException e) {
      handleIllegalArgumentException(properties, e);
    } finally {
      RolapConnectionPool.instance().clearPool();
    }
  }
Exemplo n.º 5
0
 public static void main(String[] args) {
   System.out.println("Successful");
   try {
     new Rporting().getWecId("07-JAN-2015");
   } catch (SQLException e) {
     logger.error("\nClass: " + e.getClass() + "\nMessage: " + e.getMessage() + "\n", e);
   } catch (Exception e) {
     logger.error("\nClass: " + e.getClass() + "\nMessage: " + e.getMessage() + "\n", e);
   }
 }
Exemplo n.º 6
0
 public static void main(String[] args) {
   try {
     final AnnotationConfigApplicationContext applicationContext =
         new AnnotationConfigApplicationContext("tw.base.stereotype");
     applicationContext.setScopeMetadataResolver(
         new AnnotationScopeMetadataResolver(ScopedProxyMode.TARGET_CLASS));
     applicationContext.getBean(MyRepository.class).doSomeThing();
   } catch (SQLException e) {
     System.err.println(e.getClass().getName());
   }
 }
Exemplo n.º 7
0
  public DruidConnectionHolder(DruidAbstractDataSource dataSource, Connection conn)
      throws SQLException {

    this.dataSource = dataSource;
    this.conn = conn;
    this.connectTimeMillis = System.currentTimeMillis();
    this.lastActiveTimeMillis = connectTimeMillis;

    this.underlyingAutoCommit = conn.getAutoCommit();

    {
      boolean initUnderlyHoldability = !holdabilityUnsupported;
      if (JdbcConstants.SYBASE.equals(dataSource.getDbType()) //
          || JdbcConstants.DB2.equals(dataSource.getDbType()) //
      ) {
        initUnderlyHoldability = false;
      }
      if (initUnderlyHoldability) {
        try {
          this.underlyingHoldability = conn.getHoldability();
        } catch (UnsupportedOperationException e) {
          holdabilityUnsupported = true;
          LOG.warn("getHoldability unsupported", e);
        } catch (SQLFeatureNotSupportedException e) {
          holdabilityUnsupported = true;
          LOG.warn("getHoldability unsupported", e);
        } catch (SQLException e) {
          // bug fixed for hive jdbc-driver
          if ("Method not supported".equals(e.getMessage())) {
            holdabilityUnsupported = true;
          }
          LOG.warn("getHoldability error", e);
        }
      }
    }

    this.underlyingReadOnly = conn.isReadOnly();
    try {
      this.underlyingTransactionIsolation = conn.getTransactionIsolation();
    } catch (SQLException e) {
      // compartible for alibaba corba
      if (!"com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException"
          .equals(e.getClass().getName())) {
        throw e;
      }
    }

    this.defaultHoldability = underlyingHoldability;
    this.defaultTransactionIsolation = underlyingTransactionIsolation;
    this.defaultAutoCommit = underlyingAutoCommit;
    this.defaultReadOnly = underlyingReadOnly;
  }
 private void formComponentShown(
     java.awt.event.ComponentEvent evt) { // GEN-FIRST:event_formComponentShown
   // TODO add your handling code here:
   try {
     control.carregarComboBD(cmbDB);
   } catch (SQLException erro) {
     JOptionPane.showMessageDialog(
         this, "Erro ao consultar Bancos de Dados. " + erro.getMessage() + erro.getClass());
   } catch (Exception erro) {
     JOptionPane.showMessageDialog(
         this, "Erro não esperado ao consultar Bancos. " + erro.getMessage() + erro.getClass());
   }
 } // GEN-LAST:event_formComponentShown
Exemplo n.º 9
0
 /**
  * Outputs debugging information about an SQLException (with a verbosity level of <code>Exception
  * </code>). Console output is done on stderr.
  *
  * @param e The SQLException that was thrown.
  */
 public static void ex(SQLException e) {
   if (debugger != null)
     debugger.log(
         Verbosity.Exception,
         System.err,
         e.getClass().getName()
             + ": "
             + e.getMessage()
             + " (SQLState: "
             + e.getSQLState()
             + ", VendorError: "
             + e.getErrorCode()
             + ")",
         false);
 }
  /**
   * Änder die Statusnachricht des Benutzers
   *
   * @param benutzer Der Benutzer
   * @param nachricht Die neue Statusnachricht
   */
  public void aendereStatusnachricht(String benutzer, String nachricht) {

    try {
      String query =
          "update benutzer set status_aktuell_seit = ?, statusnachricht = ? where benutzername = ?";
      PreparedStatement anweisung = con.prepareStatement(query);

      anweisung.setLong(1, System.currentTimeMillis());
      anweisung.setString(2, nachricht);
      anweisung.setString(3, benutzer);
      anweisung.executeUpdate();
    } catch (SQLException e) {
      System.err.println(e.getClass().getName() + ": " + e.getMessage());
      System.exit(1);
    }
  }
 /**
  * legt einen neuen Benutzer in der Datenbank an
  *
  * @param benutzername Benutzername des neuen Benutzers
  * @param passwort Passwort des neuen Benutzers
  */
 public void benutzerAnlegen(String benutzername, String passwort) {
   try {
     String query =
         "insert into benutzer (benutzername, statussymbol, status_aktuell_seit, passwort, online)"
             + "values(?, ?, ?, ?, ?);";
     PreparedStatement anweisung = con.prepareStatement(query);
     anweisung.setString(1, benutzername);
     anweisung.setString(2, "chat");
     anweisung.setLong(3, System.currentTimeMillis());
     anweisung.setString(4, passwort);
     anweisung.setBoolean(5, true);
     anweisung.executeUpdate();
   } catch (SQLException e) {
     System.err.println(e.getClass().getName() + ": " + e.getMessage());
     System.exit(1);
   }
 }
 private void runTerminalChangeTask(Map<String, Object> map) {
   // 5.2調用存儲過程,進行數據統計
   logger.info("Exec proc_terminalChangeTask use param:{}", map);
   try {
     manager = new TerminalChangeTaskManagerImpl();
     manager.update("proc_terminalChangeTask", map);
   } catch (SQLException e) {
     logger.error(
         "{}\n MASSAGE : {} \n CAUSE :{} \n CLASS : {}\n",
         new Object[] {"執行終端升級任務定制功能--存儲過程时,报错:", e.getMessage(), e.getCause(), e.getClass()});
     updateTaskStatus(Long.getLong(String.valueOf(map.get("nmTerminalChangeIdTaskId"))), 5);
     manager = null;
     System.exit(1);
   } finally {
     manager = null;
   }
 }
Exemplo n.º 13
0
 /**
  * This will create an arraylist of courses that will satisfy a given requirement
  *
  * @param Requirement requirement object
  * @return arraylist of class objects
  * @author Jason Beck
  */
 private ArrayList<Requirement> getCoursesForReq(int reqMapId) {
   ArrayList<Requirement> list = new ArrayList<Requirement>();
   try {
     classesSatisfyReq.setInt(1, reqMapId);
     ResultSet rs = classesSatisfyReq.executeQuery();
     while (rs.next()) {
       // creates and adds a requirement object to the list from
       // the record
       String reqCoursePrefix = rs.getString("coursePrefix");
       String reqCourseNumber = rs.getString("courseNumber").trim();
       String reqCourseTitle = rs.getString("courseTitle");
       list.add(new Requirement(reqMapId, reqCoursePrefix, reqCourseNumber, reqCourseTitle));
     }
   } catch (SQLException e) {
     System.out.println(e.getClass().getName() + ": " + e.getMessage());
   }
   return list;
 }
Exemplo n.º 14
0
 @Override
 public void init() throws ServletException {
   conn = null;
   stmt = null;
   rs = null;
   try {
     Class.forName("org.postgresql.Driver");
     conn =
         DriverManager.getConnection(
             "jdbc:postgresql://localhost:5432/rodrigov_zencherry",
             "rodrigov_zuser",
             "ycKRXXXXXX");
   } catch (ClassNotFoundException e1) {
     errormanager.printerror(e1.getClass().getName() + ": " + e1.getMessage());
   } catch (SQLException e2) {
     errormanager.printerror(e2.getClass().getName() + ": " + e2.getMessage());
   }
 }
  /**
   * Änder den Online-Status eines Benutzers
   *
   * @param benutzer Der Benutzer
   * @param online Sein nuer Online-Status
   */
  public void aendereOnlineStatus(String benutzer, boolean online) {

    try {
      String query =
          "update benutzer set online = ?, status_aktuell_seit = ?, statussymbol = ? where benutzername = ?";
      PreparedStatement anweisung = con.prepareStatement(query);

      anweisung.setBoolean(1, online);
      anweisung.setLong(2, System.currentTimeMillis());
      anweisung.setString(3, "chat");
      anweisung.setString(4, benutzer);

      anweisung.executeUpdate();
    } catch (SQLException e) {
      System.err.println(e.getClass().getName() + ": " + e.getMessage());
      System.exit(1);
    }
  }
 private TerminalChange getTerminalChange(Long nmTerminalChangeId) {
   // 4.1更具終端升級統計表ID,找到相應的統計數據
   TerminalChange terminalChange = null;
   try {
     manager = new TerminalChangeTaskManagerImpl();
     terminalChange = manager.getTerminalChange(nmTerminalChangeId);
   } catch (SQLException e) {
     logger.error(
         "{}\n MASSAGE : {} \n CAUSE :{} \n CLASS : {}\n",
         new Object[] {
           "執行終端升級任務定制功能--查詢任務狀態為未執行的任務时,报错:", e.getMessage(), e.getCause(), e.getClass()
         });
     terminalChange = null;
   } finally {
     manager = null;
   }
   return terminalChange;
 }
  private List<TerminalChangeTask> getCurrentTaskList() {
    // 2、得到當前需要執行的任務
    List<TerminalChangeTask> list = null;
    manager = new TerminalChangeTaskManagerImpl();
    try {
      list = manager.getTerminalChangeTaskList();
    } catch (SQLException e) {
      logger.error(
          "{}\n MASSAGE : {} \n CAUSE :{} \n CLASS : {}\n",
          new Object[] {
            "執行終端升級任務定制功能--查詢任務狀態為未執行的任務时,报错:", e.getMessage(), e.getCause(), e.getClass()
          });
      list = null;
    } finally {
      manager = null;
    }

    return list;
  }
  /**
   * Fragt vom Server die Kontaktliste des übergebenen Benutzers ab
   *
   * @param benutzer Der Benutzer von den die Kontaktliste geladen werden soll
   * @return Die Kontaktliste
   */
  public ResultSet get_kontaktliste(String benutzer) {

    ResultSet rueckgabewert = null;
    try {
      String query =
          "select  k.benutzername, k.online, k.statusnachricht, k.statussymbol "
              + "from "
              + "kontaktliste, benutzer AS k, benutzer AS b "
              + "where b.benutzername = ? and b.bNr = kontaktliste.besitzer and k.bNr = kontaktliste.kontakt;";

      PreparedStatement anweisung = con.prepareStatement(query);
      anweisung.setString(1, benutzer);
      rueckgabewert = anweisung.executeQuery();

    } catch (SQLException e) {
      System.err.println(e.getClass().getName() + ": " + e.getMessage());
      System.exit(1);
    }
    return rueckgabewert;
  }
  private void cmbDBItemStateChanged(
      java.awt.event.ItemEvent evt) { // GEN-FIRST:event_cmbDBItemStateChanged
    // TODO add your handling code here:

    // Limpa Tabela Itens de produtos
    DefaultTableModel tableModel = (DefaultTableModel) tblTabelas.getModel();
    tableModel.setNumRows(0);
    // Limpa Tabela de produtos Selecionados
    DefaultTableModel tableModel2 = (DefaultTableModel) tblTabelasSelecionadas.getModel();
    tableModel2.setNumRows(0);

    try {
      control.consultarTabelas(tblTabelas, cmbDB.getSelectedItem().toString());
    } catch (SQLException erro) {
      JOptionPane.showMessageDialog(
          this, "Erro ao consultar ]tabelas. " + erro.getMessage() + erro.getClass());
    } catch (Exception erro) {
      JOptionPane.showMessageDialog(
          this, "Erro não esperado ao consultar TABELAS. " + erro.getMessage() + erro.getClass());
    }
  } // GEN-LAST:event_cmbDBItemStateChanged
  /**
   * bestimmt dies Id eines Benutzers
   *
   * @param benutzername Der zu überprüfene Benutzername
   * @return Die ID des Benutzer, wenn nichts gefunden -1
   */
  public int bestimmeBNrBenutzer(String benutzername) {
    int id = -1;
    ResultSet rueckgabewert = null;
    try {
      // sendet eine Datenbnankabfrage zur Ermittelung, ob es den Benutzer schon gibt
      String query = "select bNr from benutzer where benutzername = ?";
      PreparedStatement anweisung = con.prepareStatement(query);
      anweisung.setString(1, benutzername);
      rueckgabewert = anweisung.executeQuery();

      // werdet den Rückgabewert aus
      while (rueckgabewert.next()) {
        id = rueckgabewert.getInt(1);
      }

    } catch (SQLException e) {
      System.err.println(e.getClass().getName() + ": " + e.getMessage());
      System.exit(1);
    }
    return id;
  }
  /**
   * Lädt die Statusnachricht des Benutzers
   *
   * @param benutzer Der Benutzer
   * @param nachricht Die neue Statusnachricht
   */
  public String getStatusnachricht(String benutzer) {

    String status = "";
    ResultSet rueckgabewert = null;
    try {
      String query = "select statusnachricht from benutzer where benutzername = ?";
      PreparedStatement anweisung = con.prepareStatement(query);

      anweisung.setString(1, benutzer);
      rueckgabewert = anweisung.executeQuery();

      // werdet den Rückgabewert aus
      while (rueckgabewert.next()) {
        status = rueckgabewert.getString(1);
      }
    } catch (SQLException e) {
      System.err.println(e.getClass().getName() + ": " + e.getMessage());
      System.exit(1);
    }

    return status;
  }
Exemplo n.º 22
0
  private static void assertState(StageStateMachine stateMachine, StageState expectedState) {
    assertEquals(stateMachine.getStageId(), STAGE_ID);
    assertEquals(stateMachine.getLocation(), LOCATION);
    assertSame(stateMachine.getSession(), TEST_SESSION);

    StageInfo stageInfo = stateMachine.getStageInfo(ImmutableList::of, ImmutableList::of);
    assertEquals(stageInfo.getStageId(), STAGE_ID);
    assertEquals(stageInfo.getSelf(), LOCATION);
    assertEquals(stageInfo.getSubStages(), ImmutableList.of());
    assertEquals(stageInfo.getTasks(), ImmutableList.of());
    assertEquals(stageInfo.getTypes(), ImmutableList.of(VARCHAR));
    assertSame(stageInfo.getPlan(), PLAN_FRAGMENT);

    assertEquals(stateMachine.getState(), expectedState);
    assertEquals(stageInfo.getState(), expectedState);

    if (expectedState == StageState.FAILED) {
      ExecutionFailureInfo failure = stageInfo.getFailureCause();
      assertEquals(failure.getMessage(), FAILED_CAUSE.getMessage());
      assertEquals(failure.getType(), FAILED_CAUSE.getClass().getName());
    } else {
      assertNull(stageInfo.getFailureCause());
    }
  }
Exemplo n.º 23
0
 public boolean isQueryTimeoutException(SQLException ex) {
   if (!super.isQueryTimeoutException(ex)) {
     return ex.getClass().getName().endsWith("TimeoutException");
   }
   return false;
 }
Exemplo n.º 24
0
  /**
   * @param exception
   * @return
   */
  public static Response processException(Throwable exception) {

    if (exception instanceof RollbackException
        || exception instanceof TransactionRolledbackException
        || exception instanceof ObserverException
        || exception instanceof PersistenceException
        //                || exception instanceof javax.persistence.PersistenceException
        || exception instanceof org.omg.CORBA.TRANSACTION_ROLLEDBACK) {
      return processException(exception.getCause());

    } else if (exception instanceof EJBException) {
      return processException(((EJBException) exception).getCausedByException());

    } else if (exception instanceof DatabaseException) {
      DatabaseException dbe = (DatabaseException) exception;
      return processException(dbe.getInternalException());

    } else if (exception instanceof javax.script.ScriptException) {
      javax.script.ScriptException scriptException = (javax.script.ScriptException) exception;
      logger.error(exception.getLocalizedMessage());

      if (scriptException.getCause() instanceof ConstraintViolationException) {
        return processException(scriptException.getCause());
      } else {
        return Response.status(Response.Status.BAD_REQUEST)
            .entity(
                new ExceptionWrapper(
                    "400", scriptException.getClass(), scriptException.getLocalizedMessage()))
            .build();
      }

    } else if (exception instanceof SQLException) {
      SQLException sqlException = (SQLException) exception;
      logger.error(exception.getLocalizedMessage());
      return Response.status(Response.Status.BAD_REQUEST)
          .entity(
              new ExceptionWrapper(
                  "400", sqlException.getClass(), sqlException.getLocalizedMessage()))
          .build();

    } else if (exception instanceof WegasException) {
      WegasException wegasException = (WegasException) exception;
      logger.error(exception.getLocalizedMessage());
      return Response.status(Response.Status.BAD_REQUEST)
          .entity(
              new ExceptionWrapper(
                  "400", wegasException.getClass(), wegasException.getLocalizedMessage()))
          .build();

    } else if (exception instanceof javax.validation.ConstraintViolationException) {
      javax.validation.ConstraintViolationException constraintViolationException =
          (javax.validation.ConstraintViolationException) exception;

      StringBuilder sb =
          new StringBuilder(
              RequestFacade.lookup()
                  .getBundle("com.wegas.app.errors")
                  .getString("constraint")); // internationalised error (sample)
      for (javax.validation.ConstraintViolation violation :
          constraintViolationException.getConstraintViolations()) {
        sb.append("\n")
            .append(violation.getLeafBean())
            .append(":")
            .append(violation.getRootBean())
            .append(violation.getPropertyPath());
      }
      logger.error(sb.toString());
      // constraintViolationException.getMessage()
      return Response.status(Response.Status.BAD_REQUEST)
          .entity(
              new ExceptionWrapper(
                  "400", exception.getClass(), constraintViolationException.getLocalizedMessage()))
          .build();

    } else {
      logger.error(
          RequestFacade.lookup().getBundle("com.wegas.app.errors").getString("unexpected"),
          exception); // internationalised error (sample)
      return Response.status(Response.Status.BAD_REQUEST)
          .entity(
              new ExceptionWrapper("400", exception.getClass(), exception.getLocalizedMessage()))
          .build();
    }
  }
Exemplo n.º 25
0
  /**
   * This will return all of the sections and meetings wrapped in a CourseListing object for any
   * course given as a requirement
   *
   * @param requirement requirement object
   * @return CourseListing course listing object
   * @author Jason Beck
   */
  public CourseListing getSections(Requirement requirement) {
    try {
      meetingsForCourse.setString(1, requirement.getReqCourseNumber());
      meetingsForCourse.setString(2, requirement.getReqCoursePrefix());
      ResultSet rs = meetingsForCourse.executeQuery();
      ArrayList<ClassObj> classObjList = new ArrayList<ClassObj>();
      String coursePrefix = "", courseNumber = "", courseTitle = "";
      while (rs.next()) {
        // packs the record into a ClassObj object and adds to arraylist
        int callNumber = rs.getInt("callNumber");
        coursePrefix = rs.getString("coursePrefix");
        courseNumber = rs.getString("courseNumber").trim();
        courseTitle = rs.getString("courseTitle");
        String days = rs.getString("days");
        String periodBegin = rs.getString("periodBegin");
        String periodEnd = rs.getString("periodEnd");
        String bldg = rs.getString("bldg");
        String room = rs.getString("room");
        classObjList.add(
            new ClassObj(
                callNumber,
                coursePrefix,
                courseNumber,
                courseTitle,
                days.trim(),
                periodBegin,
                periodEnd,
                bldg,
                room));
      }

      CourseListing courseListing = new CourseListing(coursePrefix, courseNumber, courseTitle);

      for (int i = 0; i < classObjList.size(); ) {
        // packages up each ClassObj into appropriate sections and meetings under the CourseListing
        // object
        ClassObj classes = classObjList.get(i);
        ClassSection section = new ClassSection(classes.getCallNumber());

        int tempCallNumber = classes.getCallNumber();
        int j = i;
        while (tempCallNumber == classes.getCallNumber() && j < classObjList.size()) {
          // packages up a meeting(s) object and adds it to the list of meeting object in the
          // ClassSection object

          // when there are multiple class meetings under a single line of a class section
          if (classes.getDays().length() > 1) {
            String day = classes.getDays();
            while (day.length() >= 1) {
              // packages up meeting objects and adds it to the list of meeting objects in the
              // ClassSection object
              // (for a single section that have multiple meeting days in it)
              ClassMeeting meeting =
                  new ClassMeeting(
                      day.substring(0, 1),
                      classes.getPeriodBegin(),
                      classes.getPeriodEnd(),
                      classes.getBldg(),
                      classes.getRoom());
              // adds meeting to section object
              section.addClassMeetingList(meeting);

              // still more than 1 day left
              if (day.length() > 1) {
                day = day.substring(2);
              }
              // only 1 day left so break
              else break;
            }
          }
          // only meets 1 day for this section
          else {
            ClassMeeting meeting =
                new ClassMeeting(
                    classes.getDays(),
                    classes.getPeriodBegin(),
                    classes.getPeriodEnd(),
                    classes.getBldg(),
                    classes.getRoom());
            // adds meeting to section object
            section.addClassMeetingList(meeting);
          }
          i = ++j;
          // must check to make sure increment will not go out of bounds
          if (j < classObjList.size()) classes = classObjList.get(j);
        }
        // adds section to courseListing object
        courseListing.addClassSectionList(section);
      }
      return courseListing;
    } catch (SQLException e) {
      System.out.println(e.getClass().getName() + ": " + e.getMessage());
    }
    return null;
  }