Skip to content

Loading…

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

Closed
doctrinebot opened this Issue · 3 comments

2 participants

@doctrinebot

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 datedefault_timezone_set("Europe/Paris"); to my config.php and appdev.php, but nothing changed.

An exception occurred while executing 'INSERT INTO arborescence (IDNTARBR, NOM_ARBR, DATE_CREATION, IDNT_SERV, IDNTUTLS) 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

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

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

Issue was closed with resolution "Fixed"

@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.