This week's book giveaway is in the Java 9 forum.
We're giving away four copies of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications and have Sander Mak & Paul Bakker on-line!
See this thread for details.
Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Trying to add information to a database using query statement  RSS feed

 
rand Kirby
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, im trying to add information to a table names users in a database. When I run this code I get the error "Can not issue data manipulation statements with executeQuery()". Should I be using a different statement? The con is already initialized and created in a different class called DBConnect. Thanks in advance!

 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37384
531
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
rand Kirby wrote:Should I be using a different statement?


Yes. executeQuery() is for SQL that begins with "select". For changing or adding data, you instead use:

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!