Exception: java.sql.SQLSyntaxErrorException: 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 ‘read bit not null.

Exception: java.sql.SQLSyntaxErrorException: 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 ‘read bit not null.

This error is caused by the SQL syntax used for creating the table. The issue lies with the column name read, which is a reserved keyword in MySQL. To fix this issue, you need to rename the read column to something that is not a reserved keyword. You can rename it to is_read or anything else that makes sense in your context. Here’s how you can modify your table creation script:

create table notification (
    id INT UNIQUE AUTO_INCREMENT,
    to varchar(255),
    name varchar(255),
    created_at datetime(6),
    remark varchar(255),
    is_read bit not null, ---------------------Renamed from `read`
) engine=
Java

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *