public void init(int startIndex, int endIndex, String updateDate) throws SQLException {

    if (connection == null || connection.isClosed()) {
      connection = getConnection();
    }
    if (startIndex != 0 && endIndex != 0) {
      bibQuery =
          "SELECT * FROM OLE_DS_BIB_T WHERE BIB_ID BETWEEN "
              + startIndex
              + " AND "
              + endIndex
              + " ORDER BY BIB_ID";
    } else if (StringUtils.isNotEmpty(updateDate)) {
      updateDate = getDateStringForOracle(updateDate);
      bibQuery = "SELECT * FROM OLE_DS_BIB_T where DATE_UPDATED > '" + updateDate + "'";
    } else {
      bibQuery = "SELECT * FROM OLE_DS_BIB_T ORDER BY BIB_ID";
    }
    if (!isStaffOnly) {
      bibQuery = bibStaffOnly;
      holdingsQuery = holdingsQuery + staffOnlyHoldings;
      itemQuery = itemQuery + staffOnlyItem;
    }

    fetchCallNumberType();
    fetchReceiptStatus();
    fetchAuthenticationType();
    fetchItemType();
    fetchItemStatus();
    fetchStatisticalSearchCode();
    fetchExtentOfOwnershipType();

    bibConnection = getConnection();
    holdingsConnection = getConnection();
    itemConnection = getConnection();
    bibConnection.setAutoCommit(false);

    bibStatement =
        bibConnection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
    if (dbVendor.equalsIgnoreCase("oracle")) {
      bibStatement.setFetchSize(1);
    } else if (dbVendor.equalsIgnoreCase("mysql")) {
      bibStatement.setFetchSize(Integer.MIN_VALUE);
    }

    bibResultSet = bibStatement.executeQuery(bibQuery);

    holdingsPreparedStatement = holdingsConnection.prepareStatement(holdingsQuery);

    itemPreparedStatement = itemConnection.prepareStatement(itemQuery);

    String insertQuery =
        "INSERT INTO OLE_DS_BIB_INFO_T(BIB_ID, BIB_ID_STR, TITLE, AUTHOR, PUBLISHER, ISXN) VALUES (?,?,?,?,?,?)";
    bibInsertPreparedStatement = connection.prepareStatement(insertQuery);

    String updateQuery =
        "UPDATE OLE_DS_BIB_INFO_T SET TITLE=?, AUTHOR=?, PUBLISHER=?, ISXN=?, BIB_ID_STR=? WHERE BIB_ID=?";
    bibUpdatePreparedStatement = connection.prepareStatement(updateQuery);
  }
 private void fetchAuthenticationType() throws SQLException {
   Statement statement = connection.createStatement();
   ResultSet resultSet =
       statement.executeQuery("SELECT CODE,NAME from OLE_DS_AUTHENTICATION_TYPE_T");
   while (resultSet.next()) {
     authenticationType.put(resultSet.getString("CODE"), resultSet.getString("NAME"));
   }
   resultSet.close();
 }
  private void fetchReceiptStatus() throws SQLException {

    Statement statement = connection.createStatement();
    ResultSet resultSet =
        statement.executeQuery("SELECT RCPT_STAT_CD,RCPT_STAT_NM from OLE_CAT_RCPT_STAT_T");
    while (resultSet.next()) {
      receiptStatus.put(resultSet.getString("RCPT_STAT_CD"), resultSet.getString("RCPT_STAT_NM"));
    }
    resultSet.close();
  }
 private void fetchStatisticalSearchCode() throws SQLException {
   Statement statement = connection.createStatement();
   ResultSet resultSet =
       statement.executeQuery(
           "SELECT STAT_SRCH_CD_ID, STAT_SRCH_CD, STAT_SRCH_NM from OLE_CAT_STAT_SRCH_CD_T");
   while (resultSet.next()) {
     statisticalSearchCodeMap.put(
         resultSet.getString("STAT_SRCH_CD_ID"),
         resultSet.getString("STAT_SRCH_CD") + "|" + resultSet.getString("STAT_SRCH_NM"));
   }
   resultSet.close();
 }
  private void fetchItemType() throws SQLException {

    Statement statement = connection.createStatement();
    ResultSet resultSet =
        statement.executeQuery("SELECT ITM_TYP_CD_ID,ITM_TYP_CD,ITM_TYP_NM from OLE_CAT_ITM_TYP_T");
    while (resultSet.next()) {
      itemTypeMap.put(
          resultSet.getString("ITM_TYP_CD_ID"),
          resultSet.getString("ITM_TYP_CD") + "|" + resultSet.getString("ITM_TYP_NM"));
    }
    resultSet.close();
  }
  private void fetchCallNumberType() throws SQLException {

    Statement statement = connection.createStatement();
    ResultSet resultSet =
        statement.executeQuery(
            "SELECT SHVLG_SCHM_ID,SHVLG_SCHM_CD,SHVLG_SCHM_NM from OLE_CAT_SHVLG_SCHM_T");
    while (resultSet.next()) {
      callNumberType.put(
          resultSet.getString("SHVLG_SCHM_ID"),
          resultSet.getString("SHVLG_SCHM_CD") + "|" + resultSet.getString("SHVLG_SCHM_NM"));
    }
    resultSet.close();
  }
 private void fetchExtentOfOwnershipType() throws SQLException {
   Statement statement = connection.createStatement();
   ResultSet resultSet =
       statement.executeQuery(
           "SELECT TYPE_OWNERSHIP_ID, TYPE_OWNERSHIP_CD,TYPE_OWNERSHIP_NM  from OLE_CAT_TYPE_OWNERSHIP_T");
   while (resultSet.next()) {
     extentOfOwnershipTypeMap.put(
         resultSet.getString("TYPE_OWNERSHIP_ID"),
         resultSet.getString("TYPE_OWNERSHIP_CD")
             + "|"
             + resultSet.getString("TYPE_OWNERSHIP_NM"));
   }
   resultSet.close();
 }
 private void fetchItemStatus() throws SQLException {
   Statement statement = connection.createStatement();
   ResultSet resultSet =
       statement.executeQuery(
           "SELECT ITEM_AVAIL_STAT_ID,ITEM_AVAIL_STAT_CD,ITEM_AVAIL_STAT_NM from OLE_DLVR_ITEM_AVAIL_STAT_T");
   while (resultSet.next()) {
     itemStatusMap.put(
         resultSet.getString("ITEM_AVAIL_STAT_ID"),
         resultSet.getString("ITEM_AVAIL_STAT_CD")
             + "|"
             + resultSet.getString("ITEM_AVAIL_STAT_NM"));
   }
   resultSet.close();
 }
 public void fetchBibHoldings() throws SQLException {
   Statement statement = connection.createStatement();
   bibHoldingsResultSet = statement.executeQuery("SELECT * FROM OLE_DS_BIB_HOLDINGS_T");
 }
 public void fetchHoldingItems() throws SQLException {
   Statement statement = connection.createStatement();
   holdingItemResultSet = statement.executeQuery("SELECT * FROM OLE_DS_ITEM_HOLDINGS_T");
 }