title: How to fix 'terminated' while using rs.getString
body: <p>When trying to pull from an SQL database, I get  in Java console.</p>
  
  <p>I am able to enter my ID manually in the prepareStatement, but I can't use setString to work with with the prepareStatement.</p>
  
  <p>I haven't throught of too much to try, but I did find that the issue is within the while statement.  rs.next returns false when it should return true.   The information in SQL has been committed, and I can call all of the information in java using a function that reads out the entire table.</p>
  
  <pre><code>getemployeeDataById("01");
  </code></pre>
  
  <pre><code>private static void getemployeeDataById(String e_id) {
      DBConnection dbConnection = DBConnection.getInstance();
      PreparedStatement ps;
  
      try {
          ps = dbConnection.getConnection().prepareStatement("select * from employee where E_ID = ?");
          ps.setString(1, e_id);
          ResultSet rs = ps.executeQuery();
  
          while (rs.next()) {
              System.out.println(rs.getString("ename"));
          }
      } catch (SQLException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>SQL </p>
  
  <pre class="lang-sql prettyprint-override"><code>CREATE TABLE EMPLOYEE
  (E_ID CHAR(3) PRIMARY KEY,
  ENAME CHAR(25),
  DOB CHAR(25),
  EMAIL CHAR(25),
  PHONE CHAR(25),
  ADDRESS CHAR(25));
  
  INSERT INTO EMPLOYEE
  VALUES
  ('01','JEREMY MANN','12/23/1992','jeremy@jeremy.com','317-528-1234','123 CandyCane Lane');
  </code></pre>
  
  <p>I am expecting to get the name outputted in the console, so for this example it would be "JEREMY MANN."  The code runs and then in the Eclipse Java console it shows  Application [Java Application].  It runs into an issue within the while statement, but I'm not sure what's causing rs.next to be false.</p>