• 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

syntax error in mysql statement

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I've centos 7 and mysql server in two VM's as server and client. I have to add contact in mysql table (tableMyContacts(Id, Fname, Lname, Group, MobileNo, Email, Address, Image,  Userid  ))
but having error in sql syntax that i am getting. please tell me how to get rid of this.

here is function that  is accessing above funciotn
 
Marshal
Posts: 69493
277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happens when you run such code from the command line? What is the error message? Does it occur at runtime of compile time?
 
Rancher
Posts: 4588
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you'll need to post the exact error you are getting, because there is no error in the line you highlighted that I can see.  It's just a String.
 
rahul vishwakarma
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes that error is occurring at run time. and when i ran it in command line no error generated in CLI. and having this error: -
mycontacts-error.png
error when i tried to add contact
error when i tried to add contact
 
Saloon Keeper
Posts: 22125
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"group" is an SQL reserved word and should not have been used as a column name.

You can work around it by escaping the reserved name like so...


But you really should rename that column because it's going to be a problem everywhere, not just in Java.
 
rahul vishwakarma
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot, you solved my problem
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic