Forum Stats

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

Discussions

Connect to oracle db instance using service name (TNS) - cx_Oracle. How?

bluef1shorcl
bluef1shorcl Member Posts: 4
edited Aug 19, 2017 11:07AM in Python

How can I connect to remote oracle instance using service_name defined in TNSNAMES,ORA defined in local and using cx_Oracle 6.0 ? any code samples available?

I have tried the conn_str = u'username/[email protected]_name'  , got this error -

cx_Oracle.DatabaseError: DPI-1041: invalid character set id 178

Best Answer

  • Anthony Tuininga-Oracle
    Anthony Tuininga-Oracle Member Posts: 37 Employee
    edited Aug 18, 2017 5:43PM Accepted Answer

    Perhaps try this?

    conn = cx_Oracle.connect(conn_str, encoding = "UTF-8", nencoding = "UTF-8")

    The error you are getting suggests that you have some information missing from your NLS libraries which the above code will bypass.

    bluef1shorcl

Answers

This discussion has been closed.