#import the module
import cx_Oracle
#create a function
def connect_to_oracle():
"""
Connect to Oracle database.
Returns
-------
cx_Oracle.Connection
Connection to Oracle database.
"""
#connect to Oracle database
connection = cx_Oracle.connect("username/password@host:port/sid")
#return the connection
return connection
#example
connection = connect_to_oracle()
#output
print(connection) #<cx_Oracle.Connection object at 0x7f8b8d9a5e10>
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)