Automate Oracle Eloqua Reporting Integration Tasks from PowerShell
The CData Cmdlets for Oracle Eloqua Reporting are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to Oracle Eloqua Reporting.
PowerShell Cmdlets or ADO.NET Provider?
The Cmdlets are not only a PowerShell interface to Oracle Eloqua Reporting, but also an SQL interface; this tutorial shows how to use both to retrieve Oracle Eloqua Reporting data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for Oracle Eloqua Reporting. To access Oracle Eloqua Reporting data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for Oracle Eloqua Reporting.
Once you have acquired the necessary connection properties, accessing Oracle Eloqua Reporting data in PowerShell can be enabled in three steps.
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.
PowerShell
-
Install the module:
Install-Module OracleEloquaReportingCmdlets
-
Connect:
$oracleeloquareporting = Connect-OracleEloquaReporting -AuthScheme "$AuthScheme" -User "$User" -Password "$Password" -Company "$Company"
-
Search for and retrieve data:
$ = "" $ = Select-OracleEloquaReporting -Connection $oracleeloquareporting -Table "" -Where " = `'$`'" $
You can also use the Invoke-OracleEloquaReporting cmdlet to execute SQL commands:
$ = Invoke-OracleEloquaReporting -Connection $oracleeloquareporting -Query 'SELECT * FROM WHERE = @' -Params @{'@'=''}
ADO.NET
-
Load the provider's assembly:
[Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Oracle Eloqua Reporting\lib\System.Data.CData.OracleEloquaReporting.dll") -
Connect to Oracle Eloqua Reporting:
$conn= New-Object System.Data.CData.OracleEloquaReporting.OracleEloquaReportingConnection("AuthScheme=Basic;User=user;Password=password;Company=MyCompany;") $conn.Open() -
Instantiate the OracleEloquaReportingDataAdapter, execute an SQL query, and output the results:
$sql="SELECT , from " $da= New-Object System.Data.CData.OracleEloquaReporting.OracleEloquaReportingDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_. $_. }