0

I've been staring at the issue for the past 2 hours with no avial. There apparently is an error with my sql query but I can't seem to find the issue.

Thanks in advance.

MySQL version: 8.0.31

Java: openjdk version "17.0.5" 2022-10-18

The sql query i'm running:

INSERT INTO users (name, age, comment, dob, email, addres) VALUES ('Jane', '48', 'coOUtqEHqY',  2015-05-145 07:47:09, '5Xi1Jdd5LrgMkU8xMv5@outlook.com', 'Suite 638 58920 Loree Path, Port Georgettechester, IL 06836');

Error:

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 '07:47:09, '5Xi1Jdd5LrgMkU8xMv5@outlook.com', 'Suite 638 58920 Loree Path, Port G' at line 1
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
        at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
        at com.mysql.cj.jdbc.StatementImpl.executeUpdateInternal(StatementImpl.java:1334)
        at com.mysql.cj.jdbc.StatementImpl.executeLargeUpdate(StatementImpl.java:2084)
        at com.mysql.cj.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1245)
        at com.dbautomation.database.DBConnection.insertSQL(DBConnection.java:56)
        at com.dbautomation.database.DBActions.insertCols(DBActions.java:53)
        at com.dbautomation.App.main(App.java:61)

SQL query for the table:

 create table users ( 
user_id int not null auto_increment, 
name varchar(100) not null, age int, 
comment varchar(255), dob DATE, 
email varchar(255), 
addres varchar(255), 
primary key (user_id));

Table Description:

enter image description here

I've tried putting the date col value surrounded in single quotes but I get the error of:

MysqlDataTruncation: Data truncation: Incorrect date value: ' 2008-06-160 11:09:11' for column 'dob' at row 1

I'm aware that address is misspelled, but that is the correct column name.

creativeAxe
  • 99
  • 1
  • 10

0 Answers0