If the words in the sql statement conflict with the keywords of mysql, just use `` (above the tab key) to enclose the words. The original sql statement<insert id="insert" parameterType="com.zhangman.manman.entity.User" > insert into user (id, username, password, name, desc, email, birthday, phone, status, createtime, roleId) values (#{id,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{desc,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{birthday,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{createtime,jdbcType=DATE}, #{roleid,jdbcType=INTEGER}) </insert> Corrected SQL (note that the field and table names are enclosed in ``)<insert id="insert" parameterType="com.zhangman.manman.entity.User" > INSERT INTO `user` (username, `password`, `name`, `desc`, email, birthday, phone, `status`, createtime, roleId) VALUES (#{username}, #{password},#{name}, #{desc},#{email}, #{birthday}, #{phone}, #{status}, #{createtime}, #{roleid}) </insert> Supplement: MySql ERROR 1064 (42000) Same error, different solution The code at the beginning is this: Then run: There is nothing wrong with the code, but why is it wrong? After spending 2 hours on it I finally found the answer. I didn't add the semicolon!!!!! Modified code: Then run again: Once again I feel despair at my own ignorance and carelessness! ! ! The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. If there are any mistakes or incomplete considerations, please feel free to correct me. You may also be interested in:
|
<<: HTML table tag tutorial (13): internal border style attributes RULES
>>: Implementation of automatic completion of Docker commands
1. Introduction to KVM The abbreviation of kernel...
How Nginx works Nginx consists of a core and modu...
(1) Experimental environment youxi1 192.168.5.101...
Table of contents Query cache optimization Overvi...
React is different from Vue. It implements route ...
1.vue packaging Here we use the vue native packag...
Table of contents 1. parse 1.1 Rules for intercep...
A colleague once told me to use a temporary table...
Table of contents 1. General steps for SQL optimi...
What is HTTP? When we want to browse a website, w...
Table of contents pom configuration Setting.xml c...
Recently, when working on mobile pages, inline-bl...
Table of contents Introduction to FTP, FTPS and S...
How to create a Linux virtual machine in VMware a...
1. The role of doctype, the difference between st...