title: Null pointer exception at preparedStatement
body: <p>I am designing simple bank application using servlet and jdbc 
  so while inserting data into database I am getting null pointer exception at preparedStatement</p>
  
  <p>my code for that is </p>
  
  <pre><code>Connection con=null;
       PreparedStatement preparedStatement =null;
  
       try
       {
       con = DBConnection.createConnection();
       String query = "insert into cst_details(name,surname,aadhar_no,contact_no,address,balance) "
              + "values (?,?,?,?,?,?)";
       preparedStatement = con.prepareStatement(query);
       preparedStatement.setString(1, name);
       preparedStatement.setString(2, surname);
       preparedStatement.setString(3, aadhar_no);
       preparedStatement.setString(4, contact_no);
       preparedStatement.setString(5, address);
       preparedStatement.setString(6,initial_bal);
  </code></pre>