Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

spring 5 jdbctemplate query for a single value

public String getStreetNameById(int id) {
    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    String sql = "SELECT STREET_NAME FROM table WHERE ID=?";

    String streetName = (String) jdbcTemplate.queryForObject(
            sql, String.class, id);

    return streetName;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #spring #jdbctemplate #query #single
ADD COMMENT
Topic
Name
2+1 =