silverkid silverkid - 2 years ago 136
Java Question

Cannot issue data manipulation statements with executeQuery()

In MySQL I have two tables,

. I am trying to execute two queries:


But I get the following error:

can not issue data manipulation statements with executeQuery().

What does this mean?

Answer Source

To manipulate data you actually need executeUpdate() rather than executeQuery().

Here's an extract from the executeUpdate() javadoc which is already an answer at its own:

Executes the given SQL statement, which may be an INSERT, UPDATE, or DELETE statement or an SQL statement that returns nothing, such as an SQL DDL statement.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download