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 fro
This is from the Java docs of interface Statement:
By default, only one ResultSet object per Statement object can be open at the same time.
So you better use a second Statement
or even better a PreparedStatement
.
And to execute an INSERT SQL statement you should use executeUpdate()
instead of executeQuery()
.