title: PreparedStatement staying null
body: <p>I am currently creating a private method inside a servlet. But my <code>PreparedStatement</code> keeps returning <code>null</code>. </p>
  
  <pre><code>private ArrayList&lt;String&gt; emails(String id) {
          ArrayList&lt;String&gt; email= new ArrayList&lt;String&gt;();
          try {
              PreparedStatement st = null;
              ResultSet data = null;
              DriverManager.getConnection(
                      "jdbc:postgresql://localhost/test",
                      "test", "test");
              String sql = "SELECT email FROM  hdpr.email_table WHERE id='"
                      + id+ "'";
              data = st.executeQuery(sql);
              while (data.next()) {
                  email.add(data.getString("email"));
              }
          } catch (SQLException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
  
          } catch (NullPointerException e) {
  
              e.getMessage();
          }
  
          return email;
  
      }
  </code></pre>