Hi there!

I'm building a small application using Java and MySQL (college assignment).
Everything is ok when all I'm doing are queries using SELECT.
Now, when I try to INSERT anything in the table, I get this error message:

java.sql.SQLException: Can not issue data manipulation statements with executeQuery(). 0 S1009

Ok, so I should use something else other than executeQuery to manipulate data (and I suppose the same will happen if I try to UPDATE the table as well).

So, please, what should I use? I tried other methods from NetBeans but did not quite understand how to use them.

This is the code I'm using:

Statement statement=conn.createStatement();
            ResultSet resultSet=statement.executeQuery(sqlstring);

Thanks!!

executeUpdate not executeQuery (on non-select queries)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.