    public final Long findRecordId(RouterSummaryTraffic record) {
        if (connection == null) {
            openConnection();
        }
        Long result = null;
        try {
            PreparedStatement pst = connection.prepareStatement("select a_id from aggreg where cisco = ? and" +
                    " iface = ? and date = ?");
            pst.setString(1, record.getRouter());
            pst.setString(2, record.getIface());
            pst.setDate(3, new java.sql.Date(record.getDate().getTime()));
            ResultSet rs = pst.executeQuery();
            if (rs.next()) {
                result = rs.getLong(1);
            }
            rs.close();
            pst.close();
        } catch (SQLException e) {
            log.error(e);
        }
        return result;
    }

    public final Long findRecordId(RouterSummaryTraffic record) {
        if (connection == null) {
            openConnection();
        }
        Long result = null;
        try {
            PreparedStatement pst = connection.prepareStatement("select a_id from aggreg where cisco = ? and" +
                    " iface = ? and dat = ?");
            pst.setString(1, record.getRouter());
            pst.setString(2, record.getIface());
            pst.setDate(3, new java.sql.Date(record.getDate().getTime()));
            ResultSet rs = pst.executeQuery();
            if (rs.next()) {
                result = rs.getLong(1);
            }
            rs.close();
            pst.close();
        } catch (SQLException e) {
            log.error(e);
        }
        return result;
    }
