python to oracle connection

1

Someone will know how to make the python to oracle connection and try to do it with

  

import cx_Oracle

but I got the following error

  

cx_Oracle.DatabaseError: DPI-1047: 32-bit Oracle Client library can not   be loaded: "The specified module could not be found". See    link for help

I hope you can help me. Greetings!

    
asked by Memo 27.03.2018 в 02:14
source

2 answers

0

As done my mini recipe is for window 7 of 64 bits it is

  • Python 2.7 64 bit is downloaded for Windows, Python
  • The Python connection module is downloaded to Oracle, Driver
  • You can try the following code by changing your values

    import cx_Oracle
    conn_str='HR/[email protected]:1521/XE'
    db_conn = cx_Oracle.connect(conn_str)
    cursor = db_conn.cursor()
    cursor.execute('SELECT * FROM countries')
    registros = cursor.fetchall()
    for r in registros:
    print str(r)
    
  • answered by 27.03.2018 в 18:50
    0

    I have implemented the following script many times and it has always worked for me. Previous you must download the Python connection module to Oracle.

    import cx_Oracle
    ip = '10.8.8.8' #ip
    port = 46  #port
    SID = 'database'
    dsn_tns = cx_Oracle.makedsn(ip, port, SID)
    connection = cx_Oracle.connect('user', 'password', dsn_tns)
    
        
    answered by 27.03.2018 в 19:00