• Post Reply Bookmark Topic Watch Topic
  • New Topic

insert and preparedStatement  RSS feed

 
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
 
Sheriff
Posts: 22949
43
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
Boost this thread!