Oracle Date Format - ORA-01861: literal does not match format string


#1

Hello,
I’m going through the video tutorial, though I’m using an Oracle database. I manually created records in the table posts, and retreiving the records from the database table worked fine… But when I got to the part regarding saving to the database, I get this error:

insert into “posts” (“body”, “created_at”, “title”, “updated_at”) values (:1, :2, :3, :4) returning “id” into :5 - ORA-01861: literal does not match format string

I’m not able to move past this. Here’s what I tried so far:

changing the updated_at and created_at fields in the posts table to be DATE instead of TIMESTAMP… still no luck

I read the post at https://adonisjs.svbtle.com/curious-case-of-date-formats-in-data-models
Regarding how the default format is: YYYY-MM-DD HH:mm:ss
In oracle, when using the to_date function… the equivalent format would be: YYYY-MM-DD HH:MI:SS
I’m wondering if the difference in MI vs SS has something to do with the error?
I tried using the formatDates to control the format, but no luck on that either.
Through debugging, I do see the bind variables change depending on the format I give it… but I still always get this error


#2

Were you able to fix this issue? Because I am seeing a similar error.


#3

No, never was… If you happen to resolve it, please post back here… Would love to have this resolved so I could give AdonisJs another shot


#4

Try updating the data type datetime.

I use mysql in my project and set the data type of created_dt and updated_dt to datetime. Here is the sample date stored in the db table 2018-05-12 18:16:27


#5

I am forced to use oracle 12c database and i am using the same datatype (timestamp with local time zone) that adonis is using to create adonis_schema for recording “migration_time”. I also went to an extent of changing oracle database nsl properties to match the format of “YYYY-MM-DD HH24:MI:SS” still i am not able to get my data into oracle database.