Jump to content

Can't connect to Oracle using PDO


Recommended Posts

Hi all,

I've used PDO without issue using MySQL but need to support Oracle as well.  I've tried the example provided with the documentation but to no avail.  Someone on Stack Overflow with a similar issue was told to try using the full connection string but that didn't work either.

Oracle:  Oracle 18c Express Edition

Server:  localhost / 127.0.0.1

Port:  1521

Database:  my_test

Username:  SYSTEM

Pass:  rootpass

The above all works fine using Oracle SQL Developer tool so not sure what the issue is.  Any ideas?

Cheers,

John

Link to comment
Share on other sites

Ooops, forgot to post my examples :)

//THis came from Stack Overflow:

$conn_string = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=my_test)))';
$pdo = new PDO('oci:dbname=' . $conn_string, 'SYSTEM', 'rootpass');

 

Might be the service name?  my_test is the name of my DB/connection.

Thx

Edited by John_1
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.