我正在尝试将一些数据插入到 mysql 数据库中,但是我收到一个错误,并且我找不到代码的错误。我不擅长mysql。
String insertQuery = "insert into books(title, author, description, prize)values("
+ title
+ ","
+ author
+ ","
+ desc
+ ", "
+ prize
+ ");";
mysql> describe books;
+-------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+-------+
| book_id | int(11) | NO | PRI | NULL | |
| title | varchar(64) | YES | | NULL | |
| author | varchar(64) | YES | | NULL | |
| description | varchar(500) | YES | | NULL | |
| prize | float | YES | | NULL | |
| added | datetime | YES | | NULL | |
+-------------+--------------+------+-----+---------+-------+
6 rows in set (0.01 sec)
我得到的错误是,
Query: insert into books(title, author, description, prize)values(sfdfdf,fdfdf,Please limiasasaat your response to 500 characters., 78.9);
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'limiasasaat your response to 500 characters., 78.9)' at line 1