To establish a connection to an Oracle database, import the connector and use the connect() method with your connection parameters.
First, import the Oracle connector module:
import devart.oracle as oracle
Call the connect() method and obtain a connection object.
my_connection = oracle.connect(
Direct=True,
Host="your_server",
ServiceName="your_service_name",
UserName="your_username",
Password="your_password"
)
Replace the example values with your actual connection values.
For more information, see Connection parameters.