Java NullPointerException is encountered
Why does this code returns a Null Pointer Exception ?

            ArrayList<OrdersAttr> ls = new ArrayList<OrdersAttr>();
            OrdersAttr myOrder = null;
            String connString = ConnStr.connString;
            String connString2 = ConnStr.connString2;

            Connection conn = null;
            Connection conn2 = null;
            Statement stmnt = null;
            Statement stmnt2 = null;
            String selectString = null;
            String insertString = null;
            String insertString2 = null;
            String updateString = null;
            int orderId = 0;

            conn = DriverManager.getConnection(connString);
            stmnt = conn.createStatement();

            selectString = "SELECT A.ORDERID AS ORDERID FROM APP.ORDERS a, APP.CUSTOMER b WHERE ORDERSTATUS = 'NEW ORDER' AND "
                    + " branchid=" + branchid + "and a.CUSTEMAIL = b.EMAIL";

            ResultSet rs = stmnt.executeQuery(selectString);
            while (rs.next()) {
                orderId = rs.getInt("ORDERID");
                myOrder = new OrdersAttr();
                myOrder.id = rs.getInt("ORDERID");
                myOrder.date = rs.getString("datetime");
                myOrder.orderitems = rs.getString("orderitems");
                myOrder.orderquantity = rs.getString("orderquantity");
                myOrder.ordersizes = rs.getString("ordersizes");
                myOrder.address = rs.getString("floor_f") + " "
                        + rs.getString("building_f") + " "
                        + rs.getString("street_f") + " "
                        + rs.getString("area_subdivision_district_f") + " "
                        + rs.getString("city_f");
                myOrder.name = rs.getString("firstname") + " " + rs.getString("lastname");
                myOrder.status = rs.getString("ORDERSTATUS");
                myOrder.contact = rs.getString("CONTACT");



                conn2 = DriverManager.getConnection(connString2);
                stmnt2 = conn2.createStatement();

                insertString = "INSERT INTO APP.ORDERS VALUES ('" + myOrder.id + "','" + myOrder.date + "','" + myOrder.orderitems + "','"
                        + myOrder.orderquantity + "','" + myOrder.ordersizes + "','" + myOrder.status + "')";
                insertString2 = "INSERT INTO APP.CUSTOMER VALUES ('" + myOrder.id + "','" + myOrder.name + "','" + myOrder.address + "','"
                        + myOrder.contact + "')";

                stmnt2.executeUpdate(insertString);
                stmnt2.executeUpdate(insertString2);

                updateString = "UPDATE APP.ORDERS SET ORDERSTATUS = 'SENT TO LOCAL BRANCH'";
                stmnt.executeUpdate(updateString);
            }

The update String is executed and it updates the database but why does it returns a null pointer exception and do not execute the insert statements? What could be the problem ? I try do debug it through commenting out some of the parts of the code but I cant still figure out the problem. What could be the problem ?
Java NullPointerException is encountered
===

Why does this code returns a Null Pointer Exception ?

            ArrayList<OrdersAttr> ls = new ArrayList<OrdersAttr>();
            OrdersAttr myOrder = null;
            String connString = ConnStr.connString;
            String connString2 = ConnStr.connString2;

            Connection conn = null;
            Connection conn2 = null;
            Statement stmnt = null;
            Statement stmnt2 = null;
            String selectString = null;
            String insertString = null;
            String insertString2 = null;
            String updateString = null;
            int orderId = 0;

            conn = DriverManager.getConnection(connString);
            stmnt = conn.createStatement();

            selectString = "SELECT A.ORDERID AS ORDERID FROM APP.ORDERS a, APP.CUSTOMER b WHERE ORDERSTATUS = 'NEW ORDER' AND "
                    + " branchid=" + branchid + "and a.CUSTEMAIL = b.EMAIL";

            ResultSet rs = stmnt.executeQuery(selectString);
            while (rs.next()) {
                orderId = rs.getInt("ORDERID");
                myOrder = new OrdersAttr();
                myOrder.id = rs.getInt("ORDERID");
                myOrder.date = rs.getString("datetime");
                myOrder.orderitems = rs.getString("orderitems");
                myOrder.orderquantity = rs.getString("orderquantity");
                myOrder.ordersizes = rs.getString("ordersizes");
                myOrder.address = rs.getString("floor_f") + " "
                        + rs.getString("building_f") + " "
                        + rs.getString("street_f") + " "
                        + rs.getString("area_subdivision_district_f") + " "
                        + rs.getString("city_f");
                myOrder.name = rs.getString("firstname") + " " + rs.getString("lastname");
                myOrder.status = rs.getString("ORDERSTATUS");
                myOrder.contact = rs.getString("CONTACT");



                conn2 = DriverManager.getConnection(connString2);
                stmnt2 = conn2.createStatement();

                insertString = "INSERT INTO APP.ORDERS VALUES ('" + myOrder.id + "','" + myOrder.date + "','" + myOrder.orderitems + "','"
                        + myOrder.orderquantity + "','" + myOrder.ordersizes + "','" + myOrder.status + "')";
                insertString2 = "INSERT INTO APP.CUSTOMER VALUES ('" + myOrder.id + "','" + myOrder.name + "','" + myOrder.address + "','"
                        + myOrder.contact + "')";

                stmnt2.executeUpdate(insertString);
                stmnt2.executeUpdate(insertString2);

                updateString = "UPDATE APP.ORDERS SET ORDERSTATUS = 'SENT TO LOCAL BRANCH'";
                stmnt.executeUpdate(updateString);
            }

The update String is executed and it updates the database but why does it returns a null pointer exception and do not execute the insert statements? What could be the problem ? I try do debug it through commenting out some of the parts of the code but I cant still figure out the problem. What could be the problem ?