Discover how a bimodal integration strategy can address the major data management challenges facing your organization today.
Get the Report →Connect to Azure Data Lake Storage Data from PowerBuilder
This article demonstrates how to access Azure Data Lake Storage data from Appeon PowerBuilder using the CData ADO.NET Provider for Azure Data Lake Storage.
This article demonstrates using the CData ADO.NET Provider for Azure Data Lake Storage in PowerBuilder, showcasing the ease of use and compatibility of these standards-based controls across various platforms and development technologies that support Microsoft .NET, including Appeon PowerBuilder.
This article shows how to create a basic PowerBuilder application that uses the CData ADO.NET Provider for Azure Data Lake Storage to retrieve data.
- In a new WPF Window Application solution, add all the Visual Controls needed for the connection properties. Below is a typical connection string:
Schema=ADLSGen2;Account=myAccount;FileSystem=myFileSystem;AccessKey=myAccessKey;InitiateOAuth=GETANDREFRESH
Authenticating to a Gen 1 DataLakeStore Account
Gen 1 uses OAuth 2.0 in Azure AD for authentication.
For this, an Active Directory web application is required. You can create one as follows:
To authenticate against a Gen 1 DataLakeStore account, the following properties are required:
- Schema: Set this to ADLSGen1.
- Account: Set this to the name of the account.
- OAuthClientId: Set this to the application Id of the app you created.
- OAuthClientSecret: Set this to the key generated for the app you created.
- TenantId: Set this to the tenant Id. See the property for more information on how to acquire this.
- Directory: Set this to the path which will be used to store the replicated file. If not specified, the root directory will be used.
Authenticating to a Gen 2 DataLakeStore Account
To authenticate against a Gen 2 DataLakeStore account, the following properties are required:
- Schema: Set this to ADLSGen2.
- Account: Set this to the name of the account.
- FileSystem: Set this to the file system which will be used for this account.
- AccessKey: Set this to the access key which will be used to authenticate the calls to the API. See the property for more information on how to acquire this.
- Directory: Set this to the path which will be used to store the replicated file. If not specified, the root directory will be used.
- Add the DataGrid control from the .NET controls.
-
Configure the columns of the DataGrid control. Below are several columns from the Account table:
<DataGrid AutoGenerateColumns="False" Margin="13,249,12,14" Name="datagrid1" TabIndex="70" ItemsSource="{Binding}"> <DataGrid.Columns> <DataGridTextColumn x:Name="idColumn" Binding="{Binding Path=Id}" Header="Id" Width="SizeToHeader" /> <DataGridTextColumn x:Name="nameColumn" Binding="{Binding Path=FullPath}" Header="FullPath" Width="SizeToHeader" /> ... </DataGrid.Columns> </DataGrid>
- Add a reference to the CData ADO.NET Provider for Azure Data Lake Storage assembly.
Connect the DataGrid
Once the visual elements have been configured, you can use standard ADO.NET objects like Connection, Command, and DataAdapter to populate a DataTable with the results of an SQL query:
System.Data.CData.ADLS.ADLSConnection conn
conn = create System.Data.CData.ADLS.ADLSConnection(connectionString)
System.Data.CData.ADLS.ADLSCommand comm
comm = create System.Data.CData.ADLS.ADLSCommand(command, conn)
System.Data.DataTable table
table = create System.Data.DataTable
System.Data.CData.ADLS.ADLSDataAdapter dataAdapter
dataAdapter = create System.Data.CData.ADLS.ADLSDataAdapter(comm)
dataAdapter.Fill(table)
datagrid1.ItemsSource=table.DefaultView
The code above can be used to bind data from the specified query to the DataGrid.