Re: Insert using connector j?
Posted by: Todd Farmer
Date: July 08, 2014 03:07PM

Hi Branden,

"call" is a reserved word in MySQL syntax:

http://dev.mysql.com/doc/refman/5.6/en/reserved-words.html

(It's used to invoke stored procedures.)

It's generally a bad idea to name columns with reserved words, but you can do it if you quote the column name with backticks. The following should work:

(ID,email,password,name,`call`,phone_number) VALUES ('"+ user[0] +"','"+ user[1] +"','"+ user[2] +"','"+ user[3] +"','"+ user[4] +"','"+ user[5] +"')");

Note that the actual SQL syntax error message is useful, here - it will tell you generally where it found a syntax error. You should see a message like the following:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'call,phone_number) VALUES (1, 2, 3, 4, 5, 6)' at line 1

It won't tell you the exact problem (the use of a reserved word, the lack of quotation marks around string values, etc.) - but it points you to the exact location of the offending element.

Hope that helps.

--
Todd Farmer
MySQL @ Oracle
http://www.oracle.com/mysql/

Options: ReplyQuote


Subject
Written By
Posted
Re: Insert using connector j?
July 08, 2014 03:07PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.