mysql 데이터베이스에 데이터를 삽입하려고하는데 오류가 발생하여 코드에서 오류를 찾을 수 없습니다. 나는 mysql이 좋지 않다.JDBC 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)
I가 얻을 오류,
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
RoseIndia에 링크하지 마십시오. http://balusc.blogspot.in/2008/06/what-is-it-with-roseindia.html. –
참조 bro에 대한 링크를 추가 했으므로 OP의 질문을 기반으로 준비된 문으로 답변을 업데이트 한 것입니다. –
+1 예를 들어. –