title: Outputting Database Contents after user input
body: <p>Im trying to do a Statement where the user would be prompted for the authors name and then all of the authors values would be output, below works but doesn't output anything. </p>
  
  <pre><code>  public static void WhichAuthorQry (Connection conn)
   {
       Scanner sc = new Scanner(System.in);
  
       try {
  
       Statement stmt = (Statement) conn.createStatement();
  
       System.out.println("Please enter the Authors name to search:");
       String name = sc.next();
  
       String SQL = "SELECT * FROM Poet WHERE PoetName='" + name + "'";
  
       ResultSet rs = stmt.executeQuery(SQL);
  
       while(rs.next()) {
           System.out.println("Name: " + rs.getString("PoetName"));
           System.out.println("Language: " + rs.getString("Language"));
  
       }
  
       }catch (Exception e){
           System.out.println("ERROR: " + e.getMessage());
       }
  
  
   }
  </code></pre>