Results 1 to 7 of 7

Thread: update problem

  1. #1
    PhQ's Avatar
    PhQ
    PhQ is offline Senior Member
    Join Date
    Mar 2010
    Location
    Lithuania
    Posts
    358
    Rep Power
    11

    Default update problem

    I get:
    Java Code:
    java.sql.SQLException: Can not issue data manipulation statements with executeQuery().
    When I do:
    Java Code:
    rs = stmt.executeQuery("UPDATE users SET xp = `50`, WHERE username = `phq`");
    What is the problem?

  2. #2
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Default

    Hello again

    I think it is SQL problem ;)

    write query like a

    UPDATE users SET xp = `50` WHERE username = `phq`
    instead of

    UPDATE users SET xp = `50`, WHERE username = `phq`
    If problem stays check your table datatypes ;)
    If my answer helped you. Please click my "REP" button and add a comment
    Have a Good Java Coding :)

  3. #3
    PhQ's Avatar
    PhQ
    PhQ is offline Senior Member
    Join Date
    Mar 2010
    Location
    Lithuania
    Posts
    358
    Rep Power
    11

    Default

    Ohh I've tried that.
    I've contacted my hosting provider they said that they don't allow this for security reasons.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    27

    Default

    I realise you've marked this as solved, but it should be executeUpdate().
    executeQuery() expects a SELECT not an UPDATE, INSERT or DELETE (ie not a data manipulation) statement.

  5. #5
    Tina Dabai is offline Member
    Join Date
    Jan 2011
    Posts
    2
    Rep Power
    0

    Default

    what strut code do i write in my strut action and strut action bean to insert, delete and update my table data in Mysql database when i have connect to my database?

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    27

    Default

    I said before in that other thread.
    Start your own thread for your question instead of hijacking an old thread.

  7. #7
    PhQ's Avatar
    PhQ
    PhQ is offline Senior Member
    Join Date
    Mar 2010
    Location
    Lithuania
    Posts
    358
    Rep Power
    11

Similar Threads

  1. Problem about JLabel not update in JPanel
    By fantasyme in forum Java Applets
    Replies: 11
    Last Post: 10-16-2011, 07:00 AM
  2. Jlabel update problem
    By fantasyme in forum AWT / Swing
    Replies: 3
    Last Post: 04-14-2010, 05:10 AM
  3. Problem in update
    By Shivraj in forum NetBeans
    Replies: 0
    Last Post: 03-24-2009, 12:11 PM
  4. Mysql/JDBC update query problem
    By thelinuxguy in forum Advanced Java
    Replies: 3
    Last Post: 02-11-2009, 09:56 PM
  5. SQL update problem
    By skiing in forum New To Java
    Replies: 9
    Last Post: 11-21-2008, 06:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •