Forum Stats

  • 3,770,608 Users
  • 2,253,140 Discussions
  • 7,875,509 Comments

Discussions

cx_Oracle ERRORS: PLease help resolve

cf425a9e-1f72-4b44-9bac-edf0da5c42ec
edited Jul 8, 2018 9:43AM in Python

In listener.ora I added

LOCALDB =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = LOCALDB)

)

)

and under SID_LIST_LISTENER I added

(SID_DESC =

(GLOBAL_DBNAME = LOCALDB)

(ORACLE_HOME = E:\Oracle11g\app\oracle\product\11.2.0\localhost)

(SID_NAME = LOCALDB)

)

)

while under tnsnames.ora I added:

LOCALDB =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = LOCALDB)

)

)

Connect statement:

con = cx_Oracle.connect("system/*****@localhost/localdb")

I was able to start the listener but I still am getting the error :

cx_Oracle.DatabaseError: ORA-12518: TNS:listener could not hand off client connection

***Moderator action (Timo): obfuscated password. User, please make sure that you don't post private data!***

clcarter

Answers

  • Christopher Jones-Oracle
    Christopher Jones-Oracle Member Posts: 1,643 Employee
    edited Jul 8, 2018 8:19AM

    Can you post details about operating systems and versions?

    The error is not related to cx_Oracle.  Have you asked anywhere else?

  • Gaz in Oz
    Gaz in Oz Member Posts: 3,785 Bronze Crown
    edited Jul 8, 2018 9:43AM
    <random HEX string> wrote:In listener.ora I addedLOCALDB =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))(CONNECT_DATA =(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:

    "...@localhost:1521/localdb"

    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?

    clcarter
This discussion has been closed.