mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-2731: Error when inserting in oracle DB : ORA-01861: literal does not match format string #3416
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.
@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 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):
Issue was closed with resolution "Fixed"