John_1 Posted July 31, 2019 Share Posted July 31, 2019 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 Quote Link to comment https://forums.phpfreaks.com/topic/309053-cant-connect-to-oracle-using-pdo/ Share on other sites More sharing options...
John_1 Posted July 31, 2019 Author Share Posted July 31, 2019 (edited) 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 July 31, 2019 by John_1 Quote Link to comment https://forums.phpfreaks.com/topic/309053-cant-connect-to-oracle-using-pdo/#findComment-1568826 Share on other sites More sharing options...
kicken Posted August 1, 2019 Share Posted August 1, 2019 According to the documentation, your DSN should look more like: new PDO('oci:dbname=//127.0.0.1:1521/my_test') Quote Link to comment https://forums.phpfreaks.com/topic/309053-cant-connect-to-oracle-using-pdo/#findComment-1568828 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.