JSON을 mySql에 문자열로 저장하려고합니다. 나는 오류가 아래에 무엇입니까 :JSON을 MySQL에 저장하기
Caused by: 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 'key, value) values ('SYSTEM_USER', '2017-11-30 13:28:38.512', 'SYSTEM_US' at line 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
코드 조각을 :
final Information informationObj = Information.newBuilder().withCreateBy("").withCreatedDate(null)
.withModifiedBy("").withModifiedDate(null).withValue(jsonString).withKey(id).build();
dataRepository.save(informationObj);
값은 DB에서 JSON의 유형입니다. 테이블의 입력란 :
`_id`, `key`, `value`, `created_date`, `created_by`, `modified_by`, `modified_date`
내가 생각하기에 json 형식은 쉼표 등의 문자가 포함되어 있기 때문일 수 있습니다. 이 json을 MYSQL DB에 저장하는 솔루션은 무엇입니까? 감사합니다.
그것이 도움이되기를 바랍니다. https://dev.mysql.com/doc/refman/5.7/en/json.html json 데이터 유형이 있습니다 – SpringLearner
버그가 코드에 있습니다. 그러나 우리는 당신의 코드가 어떻게 생겼는지에 대한 어떠한 방법도 가지고 있지 않기 때문에 ... –
Intuition : 일종의 SQL injection. 코드보기 매개 변수 사용 –