Connecting Oracle with Python via cx_Oracle extension
Installation Prerequisites Python 2.7, 3.5 or above Oracle Client / Oracle Instant Client "Basic" or "Basic Light" libaio / libaio1 package Installation Reference cx_Oracle Installation guide Sample Python Code import cx_Oracle # Make DSN address. Real values for host address, port and service name were replaced by '<>'. dsn = cx_Oracle.makedsn('<host_address>', '<port>', service_name='<service_name>') # Connect to DSN orcl = cx_Oracle.connect(user='<username>', password='<password>', dsn=dsn) # Get cursor cursor = orcl.cursor() # Execute SQL statement cursor.execute('<SQL SELECT STATEMENT>') # Fetch result data = cursor.fetchone()