Re: cx_Oracle.DatabaseError: ORA-12505: TNS:listener does not currently know of SID given in connect descriptor

From: Niall Litchfield <niall.litchfield_at_gmail.com>
Date: Wed, 14 Dec 2011 07:40:07 +0000
Message-ID: <CABe10sZfYSrCgvhUcOggDCbpYr3xKhVK85iDsqOmAur3vTDR1Q_at_mail.gmail.com>



I can't say that I'm familiar with cx_connect, I can however say that the listener.log will contain a record showing you what SID got passed to it as a result of your call. I'd also try and ensure that the exception handling prints out the values of the parms structure (array?) On Tue, Dec 13, 2011 at 4:39 PM, jose soares <jose.soares_at_sferacarta.com>wrote:

> Hi all,
>
> I'm trying to connect to a server oracle using cx_Oracle and I get the
> error:
>
> cx_Oracle.DatabaseError: ORA-12505: TNS:listener does not currently know
> of SID given in connect descriptor
>
> Here my code:
>
> def init_db_conn(parms):
> global _CONN
> import cx_Oracle
> dsn = cx_Oracle.makedsn(parms['host'],parms['port'],parms['dbname'])
> dbinfo = 'db: %s_at_%s' % (parms['user'], parms['dbname'])
> try:
> if not _CONN:
> _CONN = cx_Oracle.connect(parms['user'], parms['password'], dsn)
> except:
> ex = sys.exc_info()
> s = 'Exception: %s: %s\n%s' % (ex[0], ex[1], dbinfo)
> print s
> return None
> return _CONN
>
>
>
> if I use instead the following code it works:
>
> conn = 'myusername/Sf3r4c4rt4_at_myserver.net:1521/SHELL'
> cc = cx.connect(conn)
> print cc.version
> cc.close()
>
> What's wrong with the first function where I use makedsn?
>
>
> thanks for any help.
> j
>
>
>
>
> --
> http://www.freelists.org/webpage/oracle-l
>
>
>

-- 
Niall Litchfield
Oracle DBA
http://www.orawin.info


--
http://www.freelists.org/webpage/oracle-l
Received on Wed Dec 14 2011 - 01:40:07 CST

Original text of this message