• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

MySQL Syntax Exception

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have following SQL :

UPDATE TABLE_NAME SET FIELD_NAME = FIELD_NAME -1 WHERE ANOTHER_FIELD_NAME= 311;

I get success when i run this query directly from query browser.

However, through my java program, when i create a preparedStatement and call its execute() method it throws following MySQL Syntax Exception.

Other Details :

MySQL Connector Jar - mysql-connector-java-5.1.15-bin.jar
MySQL Version : 5.1
OS : CentOs 5.1
 
Ranch Hand
Posts: 820
IntelliJ IDE VI Editor Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ketul Parikh wrote:I have following SQL :

UPDATE TABLE_NAME SET FIELD_NAME = FIELD_NAME -1 WHERE ANOTHER_FIELD_NAME= 311;

I get success when i run this query directly from query browser.

However, through my java program, when i create a preparedStatement and call its execute() method it throws following MySQL Syntax Exception.

Other Details :

MySQL Connector Jar - mysql-connector-java-5.1.15-bin.jar
MySQL Version : 5.1
OS : CentOs 5.1



can you post the code where you create the preparedStatement?

and post the Syntax Exception? I think you forgot to paste it in there.
 
Ranch Hand
Posts: 119
Oracle Opera Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim McGuire wrote:

can you post the code where you create the preparedStatement?

and post the Syntax Exception? I think you forgot to paste it in there.

 
This tiny ad will self destruct in five seconds.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic