Using the CData ODBC Driver for Oracle Eloqua Reporting in PyCharm

Jerod Johnson
Jerod Johnson
Senior Technology Evangelist
Connect to Oracle Eloqua Reporting as an ODBC data source in PyCharm using the CData ODBC Driver for Oracle Eloqua Reporting.

The CData ODBC Drivers can be used in any environment that supports loading an ODBC Driver. In this tutorial we will explore using the CData ODBC Driver for Oracle Eloqua Reporting from within PyCharm. Included are steps for adding the CData ODBC Driver as a data source, as well as basic PyCharm code to query the data source and display results.

To begin, this tutorial will assume that you have already installed the CData ODBC Driver for Oracle Eloqua Reporting as well as PyCharm.

Add Pyodbc to the Project

Follow the steps below to add the pyodbc module to your project.

  1. Click File -> Settings to open the project settings window.
  2. Click Project Interpreter from the Project: YourProjectName menu.
  3. To add pyodbc, click the + button and enter pyodbc.
  4. Click Install Package to install pyodbc.

Connect to Oracle Eloqua Reporting

You can now connect with an ODBC connection string or a DSN. See the Getting Started section in the CData driver documentation for a guide to creating a DSN on your OS.

Oracle Eloqua Reporting supports the following authentication methods:

  • Basic authentication (User and Password)
  • OAuth 2.0 code grant flow
  • OAuth 2.0 password grant flow

Basic Authentication (User and Password)

To perform authentication with a user and password, specify these properties:

  • AuthScheme: Basic.
  • Company: The company name associated with your Oracle Eloqua Reporting account.
  • User: Your login account name.
  • Password: Your login password.

OAuth Authentication (Code Grant Flow)

To authenticate with the OAuth code grant flow, you must set AuthScheme to OAuth and create a custom OAuth application. For information about how to create a custom OAuth application, see the Help documentation.

Then set the following properties:

  • InitiateOAuth: GETANDREFRESH. Used to automatically get and refresh the OAuthAccessToken.
  • OAuthClientId: The client Id assigned when you registered your application.
  • OAuthClientSecret: The client secret that was assigned when you registered your application.
  • CallbackURL: The redirect URI that was defined when you registered your application.

When you connect, the driver opens Oracle Eloqua Reporting's OAuth endpoint in your default browser. Log in and grant permissions to the application. When the access token expires, the driver refreshes it automatically.

OAuth Authentication (Password Grant Flow)

With the OAuth password grant flow, you can use your OAuth application's credentials alongside your user credentials to authenticate without the need to grant permission manually via a browser prompt. You must create an OAuth app (see the Help documentation) to use this authentication method.

Set the following properties:

  • AuthScheme: OAuthPassword
  • Company: The company's unique identifier.
  • User: Your login account name.
  • Password: Your login password.
  • OAuthClientId: The client Id assigned when you registered your custom OAuth application.
  • OAuthClientSecret: The client secret assigned when you registered your custom OAuth application.

Below is the syntax for a DSN:

[CData OracleEloquaReporting Source]
Driver = CData ODBC Driver for Oracle Eloqua Reporting
Description = My Description
AuthScheme = Basic
User = user
Password = password
Company = MyCompany

Execute SQL to Oracle Eloqua Reporting

Instantiate a Cursor and use the execute method of the Cursor class to execute any SQL statement.

import pyodbc

cnxn = pyodbc.connect('DRIVER={CData ODBC Driver for OracleEloquaReporting};AuthScheme = Basic;User = user;Password = password;Company = MyCompany;')
cursor = cnxn.cursor()
cursor.execute("SELECT ,  FROM  WHERE  = ''")
rows = cursor.fetchall()
for row in rows:
  print(row., row.)

After connecting to Oracle Eloqua Reporting in PyCharm using the CData ODBC Driver, you will be able to build Python apps with access to Oracle Eloqua Reporting data as if it were a standard database. If you have any questions, comments, or feedback regarding this tutorial, please contact us at [email protected].

Ready to get started?

Download a free trial of the Oracle Eloqua Reporting ODBC Driver to get started:

 Download Now

Learn more:

Oracle Eloqua Reporting Icon Oracle Eloqua Reporting ODBC Driver

The Oracle Eloqua Reporting ODBC Driver is a powerful tool that allows you to connect with live data from Oracle Eloqua Reporting, directly from any applications that support ODBC connectivity.

Access Oracle Eloqua Reporting data like you would a database - read, write, and update Oracle Eloqua Reporting 0, etc. through a standard ODBC Driver interface.