Hi I have a Oracle database installed locally on my laptop. I'd like to connect to it via Codeigniter 4. Since version 4.2.0 it is able to do so.
https://codeigniter4.github.io/CodeIgniter4/changelogs/v4.2.0.html
All my database credentials are in the .env file, but I'm unable to establish connection. I'm new to Oracle.
I can connect to my database via Oracle SQL Developer.
The data I use for the connection:
- host: localhost
- port: 1521
- user: system
- password: MYPASSWORD
- service name: orcl
How can I use that in my .env file?
This is what I have so far:
database.default.hostname = localhost
database.default.database =
database.default.username = system
database.default.password = MYPASSWORD
database.default.DBDriver = oci8
database.default.DBPrefix =
database.default.port = 1521
I get this error:
Unable to connect to the database.
Main connection [oci8]: oci_connect(): ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
CodePudding user response:
(.env
file)
Try using:
database.default.hostname = '127.0.0.1:1521/orcl'
Where:
'127.0.0.1:1521/orcl', // hostname:db_port/service_name