• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

insert and preparedStatement

 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm using this code:

but i get an error:
java.sql.SQLException: Can not issue data manipulation statements with executeQuery().

is it not possible to use my insert sql with '?' and preparedstatements?

TiA
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course it is possible. But (as the error message says) you cannot use the executeQuery() method to do that. You should use the executeUpdate() method instead.
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
executeUpdate() is the one ;)
thanks, Paul
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic