'Problems with oci_connect ORA-12541: TNS:no listener
Yo guys. I have the following snippet:
$conn = oci_connect('user', 'pass', '(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)
(HOST=myhost.net)(PORT=1521)
)
)
(CONNECT_DATA=
(SERVER = DEDICATED)
(SERVICE_NAME = MYSERVICE)
)
)');
That is giving me the following error: oci_connect: ORA-12541: TNS:no listener
That's the first time I try to connect to a oracle database. What am I doing wrong? I'm on Windows.
Solution 1:[1]
Are you sure your TNS Listener service is running? You can check it by typing services.msc in the run dialogue box and you'll get a list of services running. If you do a quick lookup for Oracle, you will find TNS Listener. I am assuming your TNS entries are correct.
Solution 2:[2]
I was struggling with same error to connect oracle DB with codeigniter and finally after 2 days found some solution:
Note: This steps worked for me in Wamp server - windows 10
- First download instant client from oracle offical website and extract it into some folder https://www.oracle.com/database/technologies/instant-client/downloads.html
- Update environment variable
PATHwith instant client path i.e D:\php\instantclient_21_3 - Edit your
php.iniand uncommentextension=php_oci8_12c.dll - Restart your Wamp server
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Anshul Tiwari |
| Solution 2 | Asif Thebepotra |
