Why is While (rs.next()) statement ending after 1st iteration?

Why is While (rs.next()) statement ending after 1st iteration?

Why is While (rs.next()) statement ending after 1st iteration?

Questions

I am using a SELECT statement to get data from a table and then insert it into another table. However the line “stmt.executeQuery(query);” is inserting the first line from the table then exits. When I comment this line out, the while loop loops through all the lines printing them out. The stacktrace isn’t showing any errors. Why is this happening?