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

syntax error in mysql statement

 
Greenhorn
Posts: 18
  • 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: 70318
283
  • 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?
 
Master Rancher
Posts: 4668
49
  • 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: 18
  • 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: 22503
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: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot, you solved my problem
 
You get good luck from rubbing the belly of a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic