Example usage for java.sql ResultSet getDate

List of usage examples for java.sql ResultSet getDate

Introduction

In this page you can find the example usage for java.sql ResultSet getDate.

Prototype

java.sql.Date getDate(String columnLabel) throws SQLException;

Source Link

Document

Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Date object in the Java programming language.

Usage

From source file:com.emc.ecs.sync.service.DbService.java

protected Date getResultDate(ResultSet rs, String name) throws SQLException {
    return rs.getDate(name);
}

From source file:biblivre3.acquisition.quotation.QuotationDAO.java

private final QuotationDTO populateDto(ResultSet rs) throws Exception {
    final QuotationDTO dto = new QuotationDTO();
    dto.setSerial(rs.getInt("serial_quotation"));
    dto.setQuotationDate(rs.getDate("quotation_date"));
    dto.setSerialSupplier(rs.getInt("serial_supplier"));
    dto.setResponseDate(rs.getDate("response_date"));
    dto.setExpirationDate(rs.getDate("expiration_date"));
    dto.setDeliveryTime(rs.getInt("delivery_time"));
    dto.setResponsible(rs.getString("responsable"));
    dto.setObs(rs.getString("obs"));
    return dto;// w w  w.j a  va  2 s. co  m
}

From source file:dao.BankDao.java

public Bank readOneBank(ResultSet rs) {

    logger.info("run");

    Bank bank = Bank.createBank();/*ww w .j  ava2 s . co  m*/
    try {
        bank.setName(rs.getString("name").toUpperCase());
        bank.setCode(rs.getString("code"));
        bank.setMfo(rs.getString("mfo"));
        bank.setDate(rs.getDate("date"));
        bank.setAdress(rs.getString("adress"));
        bank.setLicense(rs.getString("license"));
        bank.setLicensedate(rs.getDate("licensedate"));
        bank.setShortName(rs.getString("shortName").toUpperCase());
        bank.setStatus(BankStatus.NORMAL);

    } catch (SQLException e) {
        logger.catching(e);
    }
    return bank;
}

From source file:eionet.transfer.dao.MetadataServiceJdbc.java

@Override
public Upload getById(String id) {
    String query = "SELECT id, expires, filename, uploader, contenttype, filesize FROM uploads WHERE id = ?";
    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);

    Upload uploadRec = jdbcTemplate.queryForObject(query, new Object[] { id }, new RowMapper<Upload>() {

        @Override//from   w  ww.j a va 2 s  . c  om
        public Upload mapRow(ResultSet rs, int rowNum) throws SQLException {
            Upload uploadRec = new Upload();
            uploadRec.setId(rs.getString("id"));
            uploadRec.setFilename(rs.getString("filename"));
            uploadRec.setExpires(rs.getDate("expires"));
            uploadRec.setUploader(rs.getString("uploader"));
            uploadRec.setContentType(rs.getString("contenttype"));
            uploadRec.setSize(rs.getLong("filesize"));
            return uploadRec;
        }
    });

    return uploadRec;
}

From source file:com.ccoe.build.dal.ProjectMapper.java

public Project mapRow(ResultSet rs, int arg1) throws SQLException {
    Project project = new Project();
    project.setName(rs.getString("name"));
    project.setGroupId(rs.getString("group_id"));
    project.setArtifactId(rs.getString("artifact_id"));
    project.setType(rs.getString("type"));
    project.setVersion(rs.getString("version"));
    project.setStartTime(rs.getDate("start_time"));
    project.setDuration(rs.getLong("duration"));
    project.setStatus(rs.getString("status"));
    return project;
}

From source file:org.psystems.dicom.browser.server.stat.StatClientRequestsChartServlet.java

/**
 * @param connection/*from   w ww  .ja va2  s  . c om*/
 * @param series
 * @param metrica
 * @param timeBegin
 * @param timeEnd
 * @param dataset
 * @throws SQLException
 */
private void getMetrics(Connection connection, String series, String metrica, long timeBegin, long timeEnd,
        DefaultCategoryDataset dataset) throws SQLException {

    PreparedStatement stmt = null;
    try {
        // String dateStr = format.format(calendar.getTime());
        // System.out.println("!!! " + dateStr);
        SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy");

        stmt = connection.prepareStatement("SELECT METRIC_VALUE_LONG, METRIC_DATE"
                + " FROM WEBDICOM.DAYSTAT WHERE METRIC_NAME = ? and " + " METRIC_DATE BETWEEN ? AND ? ");

        stmt.setString(1, metrica);
        stmt.setDate(2, new java.sql.Date(timeBegin));
        stmt.setDate(3, new java.sql.Date(timeEnd));
        ResultSet rs = stmt.executeQuery();

        while (rs.next()) {
            long value = rs.getLong("METRIC_VALUE_LONG");
            Date date = rs.getDate("METRIC_DATE");
            String dateStr = format.format(date.getTime());
            String category = dateStr;
            dataset.addValue(value, series, category);
            //            System.out.println("!!!! " + metrica + "=" + dateStr + "="
            //                  + value);
        }
        rs.close();

    } finally {
        if (stmt != null)
            stmt.close();
    }
}

From source file:com.abcd.employeemaven.dao.impl.DepartmentDaoImpl.java

public Department mapData(ResultSet rs) throws SQLException {

    Department department = new Department();
    department.setId(rs.getInt("department_id"));
    department.setDepartmentCode(rs.getString("department_code"));
    department.setDepartmentDescription(rs.getString("department_description"));
    department.setAddedDate(rs.getDate("added_date"));
    department.setModifiedDate(rs.getDate("modified_date"));
    department.setStatus(rs.getBoolean("status"));

    return department;

}

From source file:com.ewcms.component.online.dao.AdvisorDAO.java

public List<Advisor> findAdvisorByUsernam(String username) {
    String sql = "Select t1.id As t1_id,t1.title As t1_title,t1.content As t1_content,"
            + "t1.replay As t1_replay,t1.state As t1_state,t1.date As t1_date,"
            + "t2.id as t2_id,t2.matter_name As t2_name,t3.id As t3_id,t3.name As t3_name "
            + "From plugin_online_advisory t1 " + "LEFT JOIN plugin_matter t2 ON t1.matter_id =t2.id "
            + "LEFT JOIN site_organ t3 ON t1.organ_id=t3.id " + "Where t1.username = ? "
            + "Order By t1.date Desc";

    return jdbcTemplate.query(sql, new Object[] { username }, new RowMapper<Advisor>() {

        @Override/*from  www.j a v  a2  s.  com*/
        public Advisor mapRow(ResultSet rs, int rowNum) throws SQLException {
            Advisor advisor = new Advisor();
            advisor.setId(rs.getInt("t1_id"));
            advisor.setTitle(rs.getString("t1_title"));
            advisor.setState(rs.getInt("t1_state"));
            advisor.setDate(rs.getDate("t1_date"));
            advisor.setContent(rs.getString("t1_content"));
            advisor.setReplay(rs.getString("t1_replay"));
            advisor.setMatterId(rs.getInt("t2_id"));
            advisor.setMatterName(rs.getString("t2_name"));
            advisor.setOrganId(rs.getInt("t3_id"));
            advisor.setOrganName(rs.getString("t3_name"));

            return advisor;
        }
    });
}

From source file:fr.mael.microrss.ttrss.TTRssImporter.java

private void parseArticles(Connection connection, Map<Integer, Feed> feeds) throws SQLException {
    PreparedStatement statement = connection.prepareStatement(
            "SELECT * FROM ttrss_entries e INNER JOIN ttrss_user_entries ue ON ue.ref_id = e.id");
    ResultSet rs = null;
    int i = 0;//  w w  w . ja v a  2 s. c o  m
    try {
        rs = statement.executeQuery();
        while (rs.next()) {
            Article article = new Article();
            article.setContent(rs.getString("content"));
            article.setCreated(rs.getDate("date_entered"));
            article.getFeeds().add(feeds.get(rs.getInt("feed_id")));
            article.setUrl(rs.getString("link"));
            article.setAuthor(rs.getString("author"));
            article.setTitle(rs.getString("title"));
            articleService.save(article);
            i++;
            if (i % 100 == 0) {
                System.out.println(i + " articles");
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        rs.close();
    }
}

From source file:com.ccoe.build.dal.SessionMapper.java

public Session mapRow(ResultSet rs, int arg1) throws SQLException {
    Session session = new Session();
    session.setDuration(rs.getLong("duration"));
    session.setEnvironment(rs.getString("environment"));
    session.setJavaVersion(rs.getString("java_version"));
    session.setMavenVersion(rs.getString("maven_version"));
    session.setStartTime(rs.getDate("start_time"));
    session.setUserName(rs.getString("user_name"));
    session.setStatus(rs.getString("status"));
    session.setGoals(rs.getString("goals"));
    session.setAppName(rs.getString("pool_name"));
    session.setMachineName(rs.getString("machine_name"));

    Clob stacktrace = rs.getClob("full_stacktrace");
    if (stacktrace != null) {
        session.setFullStackTrace(stacktrace.getSubString(1, (int) stacktrace.length()));
    }//from w  w  w . j a va 2  s  .co m

    session.setExceptionMessage(rs.getString("cause"));
    session.setCategory(rs.getString("category"));

    session.setId(rs.getInt("id"));

    session.setFilter(rs.getString("filter"));

    return session;
}