title: Calling SQL server 2008 Stored Procedure from Java
body: <p>I have created the following stored procedure in SQL server 2008</p>
  
  <pre><code>Create PROCEDURE countInfected @infected int out
  AS
  Select @infected = COUNT(*) from userInfo where userID NOT IN (Select userID from deletedInfo);
  </code></pre>
  
  <p>My java Code is as follow </p>
  
  <pre><code>CallableStatement infected = con.prepareCall("exec countInfected()");
  infected.registerOutParameter(1, java.sql.Types.INTEGER);
  infected.execute();
      System.out.println("Infected"+ infected.getInt(1));
  </code></pre>
  
  <p>but it generate the following error</p>
  
  <blockquote>
    <p>java.lang.NullPointerException at core.dtable.Dbase.stored(Dbase.java:51)</p>
  </blockquote>
  
  <p>kindly guide me where i am wrong</p>