Discover how a bimodal integration strategy can address the major data management challenges facing your organization today.
Get the Report →Automate Oracle Eloqua Integration Tasks from PowerShell
Are you in search of a quick and easy way to access Oracle Eloqua data from PowerShell? This article demonstrates how to utilize the Oracle Eloqua Cmdlets for tasks like connecting to Oracle Eloqua data, automating operations, downloading data, and more.
The CData Cmdlets for Oracle Eloqua are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time and bidirectional access to Oracle Eloqua.
PowerShell Cmdlets or ADO.NET Provider?
The Cmdlets are not only a PowerShell interface to Oracle Eloqua, but also an SQL interface; this tutorial shows how to use both to create, retrieve, update, and delete Oracle Eloqua data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for Eloqua. To access Oracle Eloqua data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for Eloqua.
Once you have acquired the necessary connection properties, accessing Oracle Eloqua data in PowerShell can be enabled in three steps.
There are two authentication methods available for connecting to Oracle Eloqua: Login and OAuth. The Login method requires you to have the Company, User, and Password of the user.
If you do not have access to the username and password or do not wish to require them, you can use OAuth authentication. OAuth is better suited for allowing other users to access their own data. Using login credentials is better suited for accessing your own data.
PowerShell
-
Install the module:
Install-Module OracleEloquaCmdlets
-
Connect:
$oracleeloqua = Connect-OracleEloqua -User "$User" -Password "$Password" -Company "$Company"
-
Search for and retrieve data:
$shipcity = "New York" $campaign = Select-OracleEloqua -Connection $oracleeloqua -Table "Campaign" -Where "ShipCity = `'$ShipCity`'" $campaign
You can also use the Invoke-OracleEloqua cmdlet to execute SQL commands:
$campaign = Invoke-OracleEloqua -Connection $oracleeloqua -Query 'SELECT * FROM Campaign WHERE ShipCity = @ShipCity' -Params @{'@ShipCity'='New York'}
ADO.NET
-
Load the provider's assembly:
[Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Eloqua\lib\System.Data.CData.OracleEloqua.dll")
-
Connect to Oracle Eloqua:
$conn= New-Object System.Data.CData.OracleEloqua.OracleEloquaConnection("User=user;Password=password;Company=CData;") $conn.Open()
-
Instantiate the OracleEloquaDataAdapter, execute an SQL query, and output the results:
$sql="SELECT Name, ActualCost from Campaign" $da= New-Object System.Data.CData.OracleEloqua.OracleEloquaDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.name $_.actualcost }
Update Oracle Eloqua Data
PowerShell
Update-OracleEloqua -Connection $OracleEloqua -Columns @('Name','ActualCost') -Values @('MyName', 'MyActualCost') -Table Campaign -Id "MyId"
ADO.NET
$cmd = New-Object System.Data.CData.OracleEloqua.OracleEloquaCommand("UPDATE Campaign SET ShipCity='New York' WHERE Id = @myId", $conn)
$cmd.Parameters.Add((New-Object System.Data.CData.OracleEloqua.OracleEloquaParameter("@myId","10456255-0015501366")))
$cmd.ExecuteNonQuery()
Insert Oracle Eloqua Data
PowerShell
Add-OracleEloqua -Connection $OracleEloqua -Table Campaign -Columns @("Name", "ActualCost") -Values @("MyName", "MyActualCost")
ADO.NET
$cmd = New-Object System.Data.CData.OracleEloqua.OracleEloquaCommand("INSERT INTO Campaign (ShipCity) VALUES (@myShipCity)", $conn)
$cmd.Parameters.Add((New-Object System.Data.CData.OracleEloqua.OracleEloquaParameter("@myShipCity","New York")))
$cmd.ExecuteNonQuery()
Delete Oracle Eloqua Data
PowerShell
Remove-OracleEloqua -Connection $OracleEloqua -Table "Campaign" -Id "MyId"
ADO.NET
$cmd = New-Object System.Data.CData.OracleEloqua.OracleEloquaCommand("DELETE FROM Campaign WHERE Id=@myId", $conn)
$cmd.Parameters.Add((New-Object System.Data.CData.OracleEloqua.OracleEloquaParameter("@myId","001d000000YBRseAAH")))
$cmd.ExecuteNonQuery()
CodeProject