title: The method queryForInt(String) is undefined for the type JdbcTemplate
body: <p>I'm trying to execute a sql query and try to get its value in a integer variable, but I'm getting a compile time error saying</p>
  
  <blockquote>
    <p>The method queryForInt(String) is undefined for the type JdbcTemplate</p>
  </blockquote>
  
  <p>My code is correct I think, so I have problem in my pom file.</p>
  
  <p>my pom.xml file:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
    &lt;groupId&gt;sql&lt;/groupId&gt;
    &lt;artifactId&gt;sql&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;packaging&gt;jar&lt;/packaging&gt;
  
    &lt;name&gt;sql&lt;/name&gt;
    &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
    &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;spring.version&gt;4.1.0.RELEASE&lt;/spring.version&gt;
    &lt;/properties&gt;
  
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;junit&lt;/groupId&gt;
        &lt;artifactId&gt;junit&lt;/artifactId&gt;
        &lt;version&gt;3.8.1&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
  
  
     &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
  
  
  
      &lt;dependency&gt;
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;spring-jdbc&lt;/artifactId&gt;
      &lt;version&gt;4.2.0.RELEASE&lt;/version&gt;
  &lt;/dependency&gt;
  
  
  
      &lt;dependency&gt;
          &lt;groupId&gt;mysql&lt;/groupId&gt;
          &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
          &lt;version&gt;5.1.9&lt;/version&gt;
      &lt;/dependency&gt;
  
  
    &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>my app.java file:</p>
  
  <pre><code>package sql.sql;
  
  
  import java.sql.ResultSet;
  import java.sql.SQLException;
  //import org.springframework.jdbc.core;
  import java.util.List;
  
  import javax.sql.DataSource;
  
  //import org.springframework.jdbc.datasource.DriverManagerDataSource;
  import org.springframework.context.ApplicationContext;
  import org.springframework.context.support.ClassPathXmlApplicationContext;
  import org.springframework.jdbc.core.JdbcTemplate;
  
  
  public class App 
  {
      public static void main( String[] args )
      {
          //DataSource dataSource = null ;
          ApplicationContext context = 
                  new ClassPathXmlApplicationContext("web.xml");
          DataSource obj = (DataSource) context.getBean("dataSource");
           JdbcTemplate jdbcTemplateObject = new JdbcTemplate(obj);
  
  
          String SQL1 = "select count(*) from issues";
          int row1 = jdbcTemplateObject.queryForInt(SQL1);
          System.out.println(row1);
  
          System.out.println( "Hello World!" );
      }
  }
  </code></pre>