We are proud to share our inclusion in the 2024 Gartner Magic Quadrant for Data Integration Tools. We believe this recognition reflects the differentiated business outcomes CData delivers to our customers.
Get the Report →Automate Oracle SCM Integration Tasks from PowerShell
Are you in search of a quick and easy way to access Oracle SCM data from PowerShell? This article demonstrates how to utilize the Oracle SCM Cmdlets for tasks like connecting to Oracle SCM data, automating operations, downloading data, and more.
The CData Cmdlets for Oracle SCM 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 SCM.
PowerShell Cmdlets or ADO.NET Provider?
The Cmdlets are not only a PowerShell interface to Oracle SCM, but also an SQL interface; this tutorial shows how to use both to retrieve Oracle SCM data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for Oracle SCM. To access Oracle SCM data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for Oracle SCM.
Once you have acquired the necessary connection properties, accessing Oracle SCM data in PowerShell can be enabled in three steps.
The following connection properties are required to connect to Oracle SCM data.
- Url: The URL of the account that you want to connect to. Typically, this will be the URL of your Oracle Cloud service. For example, https://servername.fa.us2.oraclecloud.com.
- User: The username of your Oracle Cloud service account.
- Password: The password of your Oracle Cloud service account.
PowerShell
-
Install the module:
Install-Module OracleSCMCmdlets
-
Connect:
$oraclescm = Connect-OracleSCM -Url "$Url" -User "$User" -Password "$Password"
-
Search for and retrieve data:
$activeflag = "false" $carriers = Select-OracleSCM -Connection $oraclescm -Table "Carriers" -Where "ActiveFlag = `'$ActiveFlag`'" $carriers
You can also use the Invoke-OracleSCM cmdlet to execute SQL commands:
$carriers = Invoke-OracleSCM -Connection $oraclescm -Query 'SELECT * FROM Carriers WHERE ActiveFlag = @ActiveFlag' -Params @{'@ActiveFlag'='false'}
ADO.NET
-
Load the provider's assembly:
[Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Oracle SCM\lib\System.Data.CData.OracleSCM.dll")
-
Connect to Oracle SCM:
$conn= New-Object System.Data.CData.OracleSCM.OracleSCMConnection("Url=https://myinstance.oraclecloud.com;User=user;Password=password;") $conn.Open()
-
Instantiate the OracleSCMDataAdapter, execute an SQL query, and output the results:
$sql="SELECT CarrierId, CarrierName from Carriers" $da= New-Object System.Data.CData.OracleSCM.OracleSCMDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.carrierid $_.carriername }