Ready to get started?

Learn more about the CData ADO.NET Provider for SQL Analysis Services or download a free trial:

Download Now

Connect to SQL Analysis Services Data from PowerBuilder

This article demonstrates how to access SQL Analysis Services data from PowerBuilder using the CData ADO.NET Provider for SQL Analysis Services.

The CData ADO.NET providers are easy-to-use, standards-based controls that can be used from any platform or development technology that supports Microsoft .NET, including PowerBuilder. This article shows how to use the CData ADO.NET Provider for SQL Analysis Services in PowerBuilder.

This article shows how to create a basic PowerBuilder application that uses the CData ADO.NET Provider for SQL Analysis Services to perform reads and writes.

  1. In a new WPF Window Application solution, add all the Visual Controls needed for the connection properties. Below is a typical connection string:

    User=myuseraccount;Password=mypassword;URL=http://localhost/OLAP/msmdpump.dll;

    To connect, provide authentication and set the Url property to a valid SQL Server Analysis Services endpoint. You can connect to SQL Server Analysis Services instances hosted over HTTP with XMLA access. See the Microsoft documentation to configure HTTP access to SQL Server Analysis Services.

    To secure connections and authenticate, set the corresponding connection properties, below. The data provider supports the major authentication schemes, including HTTP and Windows, as well as SSL/TLS.

    • HTTP Authentication

      Set AuthScheme to "Basic" or "Digest" and set User and Password. Specify other authentication values in CustomHeaders.

    • Windows (NTLM)

      Set the Windows User and Password and set AuthScheme to "NTLM".

    • Kerberos and Kerberos Delegation

      To authenticate with Kerberos, set AuthScheme to NEGOTIATE. To use Kerberos delegation, set AuthScheme to KERBEROSDELEGATION. If needed, provide the User, Password, and KerberosSPN. By default, the data provider attempts to communicate with the SPN at the specified Url.

    • SSL/TLS:

      By default, the data provider attempts to negotiate SSL/TLS by checking the server's certificate against the system's trusted certificate store. To specify another certificate, see the SSLServerCert property for the available formats.

    You can then access any cube as a relational table: When you connect the data provider retrieves SSAS metadata and dynamically updates the table schemas. Instead of retrieving metadata every connection, you can set the CacheLocation property to automatically cache to a simple file-based store.

    See the Getting Started section of the CData documentation, under Retrieving Analysis Services Data, to execute SQL-92 queries to the cubes.

  2. Add the DataGrid control from the .NET controls.
  3. 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=Fiscal_Year}" Header="Fiscal_Year" Width="SizeToHeader" /> ... </DataGrid.Columns> </DataGrid>
  4. Add a reference to the CData ADO.NET Provider for SQL Analysis Services 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.SSAS.SSASConnection conn conn = create System.Data.CData.SSAS.SSASConnection(connectionString) System.Data.CData.SSAS.SSASCommand comm comm = create System.Data.CData.SSAS.SSASCommand(command, conn) System.Data.DataTable table table = create System.Data.DataTable System.Data.CData.SSAS.SSASDataAdapter dataAdapter dataAdapter = create System.Data.CData.SSAS.SSASDataAdapter(comm) dataAdapter.Fill(table) datagrid1.ItemsSource=table.DefaultView

The code above can be used to bind data from the specified query to the DataGrid.