I started a Symfony 4.3 project and I have to work with an Oracle 11g database for this project. However, the documentation of Symfony does not offer enough lucidity on the subject, especially the configuration to connect to an oracle database. It's almost 3 days since I tried to solve this problem, but I found nothing.
//.env
DATABASE_URL=mysql://user:pass@127.0.0.1:3306/the_spacebar
DATABASE_CUSTOMER_URL=pdo_oci://user:pass@localhost:1521/XE
//doctrine.yaml
doctrine:
dbal:
default_connection: default
connections:
default:
# configure these for your database server
driver: 'pdo_mysql'
server_version: '5.7'
charset: utf8mb4
default_table_options:
charset: utf8mb4
collate: utf8mb4_unicode_ci
url: '%env(resolve:DATABASE_URL)%'
customer:
# configure these for your database server
driver: 'pdo_oci'
server_version: ~
charset: AL32UTF8
default_table_options:
charset: AL32UTF8
collate: ~
url: '%env(resolve:DATABASE_CUSTOMER_URL)%'
orm:
default_entity_manager: default
entity_managers:
default:
connection: default
mappings:
Main:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity/Main'
prefix: 'App\Entity\Main'
alias: Main
customer:
connection: customer
mappings:
Customer:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity/Customer'
prefix: 'App\Entity\Customer'
alias: Customer
The error was:
An exception occurred in driver: SQLSTATE[HY000]: pdo_oci_handle_factory: ORA-12505: TNS:listener does not currently know of SID given in connect descriptor
(ext\pdo_oci\oci_driver.c:634)