Database Connection PHP to OracleDB

Do you have questions regarding other database enginges (not MySQL) -- ask here!

Moderators: gesf, Michalio

Post Reply
webstarter7
New php-forum User
New php-forum User
Posts: 3
Joined: Tue Dec 06, 2022 7:35 am

Hello, i am new here and new to PHP.
I am trying to connect my application with the oracleDB i got provided.
So i have got a TNS entry of the database. Something like this:

Code: Select all

myname =
(DESCRIPTION=
(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=xxxxx.com)(PORT=1530)))
(CONNECT_DATA=(SERVICE_NAME=dbname))
)
and i got provided an jdbc code, like this:

Code: Select all

jdbc:oracle:thin@//xxx-x.xxxxxx.com:1530/myname
.

I never worked with Oracle Database before, so i have no idea. I tried some reserach but only found informations about

Code: Select all

oci_connect
but i think this is not the right for me.

Can u help me to build the connection please.

Thank you mates!
User avatar
Michalio
Moderator
Moderator
Posts: 337
Joined: Sun Jul 18, 2021 1:33 pm
Location: Poland

Try to use PDO:
http://www.learn-coding.today/php_pdo_oracle.php
Free coding lessons: https://php-forum.com/phpforum/viewtopic.php?t=29852
webstarter7
New php-forum User
New php-forum User
Posts: 3
Joined: Tue Dec 06, 2022 7:35 am

i cannot get the connection, dont know whats the problem. I dont get any errors
webstarter7
New php-forum User
New php-forum User
Posts: 3
Joined: Tue Dec 06, 2022 7:35 am

So i get

Code: Select all

could not find driver
.
Can u help me with the problem?
User avatar
Michalio
Moderator
Moderator
Posts: 337
Joined: Sun Jul 18, 2021 1:33 pm
Location: Poland

on windows you need to find php.ini file and find that line:

Code: Select all

;extension=php_pdo_oci.dll
and remove the semicolon
on linux try to run:

Code: Select all

sudo apt-get install php php-dev php-pear php-cli libaio1
sudo pecl install pdo
after changes you need to restart php-fpm or http server (like apache2)
Free coding lessons: https://php-forum.com/phpforum/viewtopic.php?t=29852
Post Reply