Hi everyone. I am trying to use laravel with an oracle database and docker compose. But I’m having problems with the database. I have always been a postgrest user.
this is the console output when I set a php artisan migrate:
Yajra\Pdo\Oci8\Exceptions\Oci8Exception
ORA-12545: Connect failed because target host or object does not exist
this is the docker-compose.yml
version: '3.8'
services:
webserver:
image: nginx:latest
container_name: webserver
restart: unless-stopped
depends_on:
- backend
ports:
- "8001:80"
volumes:
- ./:/var/www
- ./Dockerfiles/nginx:/etc/nginx/conf.d
networks:
app-network:
backend:
build:
context: Dockerfiles/php
dockerfile: Dockerfile
container_name: backend
volumes:
- ./:/var/www
- ./Dockerfiles/php/php.ini:/usr/local/etc/php/conf.d/local.ini
networks:
app-network:
database:
build:
context: Dockerfiles/oracle
dockerfile: Dockerfile
container_name: oracle-db
environment:
ORACLE_PASSWORD: oracle
ORACLE_ALLOW_REMOTE: true
ORACLE_DISABLE_ASYNCH_IO: true
ORACLE_ENABLE_XDB: true
ports:
- "1521:1521"
- "5500:5500"
- "8081:8080"
volumes:
- oracle-data:/opt/oracle/oradata
networks:
app-network:
volumes:
app-data:
oracle-data:
Also, in laravel /config/oracle.php file I set:
<?php
return [
'oracle' => [
'driver' => 'oracle',
'tns' => env('DB_TNS', ''),
'host' => env('DB_HOST', 'oracle_db'),
'port' => env('DB_PORT', '1521'),
'database' => env('DB_DATABASE', 'xe'),
'service_name' => env('DB_SERVICE_NAME', 'portal'),
'username' => env('DB_USERNAME', 'system'),
'password' => env('DB_PASSWORD', 'oracle'),
'charset' => env('DB_CHARSET', 'AL32UTF8'),
'prefix' => env('DB_PREFIX', ''),
'prefix_schema' => env('DB_SCHEMA_PREFIX', ''),
'edition' => env('DB_EDITION', 'ora$base'),
'server_version' => env('DB_SERVER_VERSION', '11g'),
'load_balance' => env('DB_LOAD_BALANCE', 'yes'),
'dynamic' => [],
],
];
Could you please tell me what am I forgetting? I also for laravel I followed this instructions: Installation - Laravel Oci8 - YajraBox