Can you post details about operating systems and versions?
The error is not related to cx_Oracle. Have you asked anywhere else?
<random HEX string> wrote:
In listener.ora I added
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(SERVER = DEDICATED)
(SERVICE_NAME = LOCALDB)
That is wrong, you do not add tnsnames entry to listener, you should just add it to tnsnames.ora, hopefully properly formated, something like:
LOCALDB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = LOCALDB) ) )
Regardless of the changes you made erroneously to listener.ora and the addition of LOCALDB to your tnsnames,ora, you connection code will not try and use tnsnames.ora any way.
Looks like a ezconnect connect string:
con = cx_Oracle.connect("system/*****@localhost/localdb")
...saying "connect to service localdb on localhost). You should try adding in the listener port too, just to be sure:
to be explicit.
Some other things to check:
. Is the db running on the same machine as you are running your code on?
(if not, then "localhost" will not work).
. Does "lsnrctl status" show a Service listening for LOCALDB?