DDC-2731: Error when inserting in oracle DB : ORA-01861: literal does not match format string #3416

Closed
opened 2026-01-22 14:19:28 +01:00 by admin · 3 comments
Owner

Originally created by @doctrinebot on GitHub (Oct 9, 2013).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user iftah:

I moved my project from MySQL to Oracle, and I get this error when I try to insert into the database.

This error is caused by the date format, in my form the date format is dd/mm/yyyy, so my question is HOW DOES SYMFONY2 GET THE DATE FORMAT BEFORE DB INSERT?

I added this date_default_timezone_set("Europe/Paris"); to my config.php and app_dev.php, but nothing changed.

An exception occurred while executing 'INSERT INTO arborescence (IDNT_ARBR, NOM_ARBR, DATE_CREATION, IDNT_SERV, IDNT_UTLS) VALUES (?, ?, ?, ?, ?)' with params [7, "B", "2013-10-09 00:00:00", 7, 1]:

ORA-01861: literal does not match format string

Any ideas on how to solve this would be really appreciated.

Originally created by @doctrinebot on GitHub (Oct 9, 2013). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user iftah: I moved my project from MySQL to Oracle, and I get this error when I try to insert into the database. This error is caused by the date format, in my form the date format is dd/mm/yyyy, so my question is HOW DOES SYMFONY2 GET THE DATE FORMAT BEFORE DB INSERT? I added this date_default_timezone_set("Europe/Paris"); to my config.php and app_dev.php, but nothing changed. An exception occurred while executing 'INSERT INTO arborescence (IDNT_ARBR, NOM_ARBR, DATE_CREATION, IDNT_SERV, IDNT_UTLS) VALUES (?, ?, ?, ?, ?)' with params [7, "B", "2013-10-09 00:00:00", 7, 1]: ORA-01861: literal does not match format string Any ideas on how to solve this would be really appreciated.
admin added the Bug label 2026-01-22 14:19:28 +01:00
admin closed this issue 2026-01-22 14:19:28 +01:00
Author
Owner

@doctrinebot commented on GitHub (Oct 10, 2013):

Comment created by iftah:

I solved this problem by adding the following code to : app/config/config.yml

services:
oracle.listener:
class: Doctrine\DBAL\Event\Listeners\OracleSessionInit
tags:
- { name: doctrine.event_listener, event: postConnect }

This seems to be a bug in Symfony2 DoctrineBundle. If we use the MySQL
driver, the corresponding MysqlSessionInit is loaded properly in the
Dependency Injection extension. But this doesn't happen with the
OracleSessionInit class, if we use the Oracle driver.

I hope someone is going to find this helpful.

Respect,
iftah

@doctrinebot commented on GitHub (Oct 10, 2013): Comment created by iftah: I solved this problem by adding the following code to : app/config/config.yml services: oracle.listener: class: Doctrine\DBAL\Event\Listeners\OracleSessionInit tags: - { name: doctrine.event_listener, event: postConnect } This seems to be a bug in Symfony2 DoctrineBundle. If we use the MySQL driver, the corresponding MysqlSessionInit is loaded properly in the Dependency Injection extension. But this doesn't happen with the OracleSessionInit class, if we use the Oracle driver. I hope someone is going to find this helpful. Respect, iftah
Author
Owner

@doctrinebot commented on GitHub (Oct 10, 2013):

Comment created by iftah:

I solved this problem by adding the following code to : app/config/config.yml

services:
oracle.listener:
class: Doctrine\DBAL\Event\Listeners\OracleSessionInit
tags:
- { name: doctrine.event_listener, event: postConnect }

This seems to be a bug in the DoctrineBundle. If we use the MySQL driver, the corresponding MysqlSessionInit is loaded properly in the Dependency Injection extension. But this doesn't happen with the OracleSessionInit class, if you we the Oracle driver.

@doctrinebot commented on GitHub (Oct 10, 2013): Comment created by iftah: I solved this problem by adding the following code to : app/config/config.yml services: oracle.listener: class: Doctrine\DBAL\Event\Listeners\OracleSessionInit tags: - { name: doctrine.event_listener, event: postConnect } This seems to be a bug in the DoctrineBundle. If we use the MySQL driver, the corresponding MysqlSessionInit is loaded properly in the Dependency Injection extension. But this doesn't happen with the OracleSessionInit class, if you we the Oracle driver.
Author
Owner

@doctrinebot commented on GitHub (Oct 10, 2013):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Oct 10, 2013): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3416