Automate Phoenix Integration Tasks from PowerShell

Ready to get started?

Download for a free trial:

Download Now

Learn more:

Phoenix ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with HBase through Apache Phoenix.

Are you looking for a quick and easy way to access Phoenix data from PowerShell? We show how to use the Cmdlets for Phoenix and the CData ADO.NET Provider for Phoenix to connect to Phoenix data and synchronize, automate, download, and more.

The CData Cmdlets for Phoenix are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to Phoenix.

Cmdlets or ADO.NET?

The cmdlets are not only a PowerShell interface to the Phoenix API, but also an SQL interface; this tutorial shows how to use both to retrieve Phoenix data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for Phoenix. To access Phoenix data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for Phoenix.

After obtaining the needed connection properties, accessing Phoenix data in PowerShell consists of three basic steps.

Connect to Apache Phoenix via the Phoenix Query Server. Set the Server and Port (if different from the default port) properties to connect to Apache Phoenix. The Server property will typically be the host name or IP address of the server hosting Apache Phoenix.

Authenticating to Apache Phoenix

By default, no authentication will be used (plain). If authentication is configured for your server, set AuthScheme to NEGOTIATE and set the User and Password properties (if necessary) to authenticate through Kerberos.


  1. Install the module:

    Install-Module ApachePhoenixCmdlets
  2. Connect:

    $apachephoenix = Connect-ApachePhoenix -Server "$Server" -Port "$Port"
  3. Search for and retrieve data:

    $id = "123456" $mytable = Select-ApachePhoenix -Connection $apachephoenix -Table "MyTable" -Where "Id = `'$Id`'" $mytable

    You can also use the Invoke-ApachePhoenix cmdlet to execute SQL commands:

    $mytable = Invoke-ApachePhoenix -Connection $apachephoenix -Query 'SELECT * FROM MyTable WHERE Id = @Id' -Params @{'@Id'='123456'}


  1. Load the provider's assembly:

    [Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Phoenix\lib\System.Data.CData.ApachePhoenix.dll")
  2. Connect to Phoenix:

    $conn= New-Object System.Data.CData.ApachePhoenix.ApachePhoenixConnection("Server=localhost;Port=8765;") $conn.Open()
  3. Instantiate the ApachePhoenixDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Id, Column1 from MyTable" $da= New-Object System.Data.CData.ApachePhoenix.ApachePhoenixDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $ $_.column1 }