2 Replies Latest reply on Jul 8, 2018 1:43 PM by Gaz in Oz

    cx_Oracle ERRORS: PLease help resolve

    cf425a9e-1f72-4b44-9bac-edf0da5c42ec

      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!***

        • 1. Re: cx_Oracle ERRORS: PLease help resolve
          cj

          Can you post details about operating systems and versions?

           

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

          • 2. Re: cx_Oracle ERRORS: PLease help resolve
            Gaz in Oz

            <random HEX string> wrote:

             

            In listener.ora I added

            LOCALDB =

            (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?