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.MySQL UPDATE JOIN syntax In MySQL, you can use ...
It is recommended to use the sudo su command to s...
Table of contents 1 element offset series 1.1 Off...
Disable Build Partition expressions do not suppor...
Table of contents 1. Introduction 2. Several key ...
This article shares the specific code of Vue usin...
We better start paying attention, because HTML Po...
Table of contents Features Advantages Installatio...
This article example shares the application code ...
Table of contents Method 1: The simplest way to s...
Related articles: Beginners learn some HTML tags ...
I recently upgraded a test server operating syste...
On web pages, we often encounter this situation: ...
This article shares the Java connection MySQL und...
Overview Let's summarize some SQL statements ...