Connect to Snowflake Data from PowerBuilder



This article demonstrates how to access Snowflake data from PowerBuilder using the Snowflake JDBC Driver.

The CData JDBC driver for Snowflake is a standards-based control that can be used from any platform or development technology that supports JDBC, including PowerBuilder. This article shows how to use the CData JDBC Driver for Snowflake in PowerBuilder.

This article shows how to create a basic PowerBuilder application that uses the CData JDBC Driver for Snowflake to perform reads and writes.

About Snowflake Data Integration

CData simplifies access and integration of live Snowflake data. Our customers leverage CData connectivity to:

  • Reads and write Snowflake data quickly and efficiently.
  • Dynamically obtain metadata for the specified Warehouse, Database, and Schema.
  • Authenticate in a variety of ways, including OAuth, OKTA, Azure AD, Azure Managed Service Identity, PingFederate, private key, and more.

Many CData users use CData solutions to access Snowflake from their preferred tools and applications, and replicate data from their disparate systems into Snowflake for comprehensive warehousing and analytics.

For more information on integrating Snowflake with CData solutions, refer to our blog: https://www.cdata.com/blog/snowflake-integrations.


Getting Started


Connect to Snowflake Data from PowerBuilder

Follow the steps below to use the Database Painter tool to create a database profile based on an JDBC URL for Snowflake. You can use a database profile to save connection properties. In the Database Painter, you can graphically manipulate data as well as execute SQL queries.

  1. Add the driver JAR to the PowerBuilder classpath. Set the CLASSPATH system environment variable to the path to the driver JAR, located in the lib subfolder of the installation directory.

    Note: If you are using PowerBuilder Classic, you can also add the path to the driver JAR by clicking Tools -> System Options -> Java.

  2. Click Tools -> Database Painter.
  3. Right-click the JDBC node and click New Profile.
  4. In the Database Profile Setup dialog, enter the following:
    • Profile Name: Enter a user-friendly name for the profile.
    • Driver Name: Enter the class name of the driver, cdata.jdbc.snowflake.SnowflakeDriver
    • URL: Enter the JDBC URL.

      To connect to Snowflake:

      1. Set User and Password to your Snowflake credentials and set the AuthScheme property to PASSWORD or OKTA.
      2. Set URL to the URL of the Snowflake instance (i.e.: https://myaccount.snowflakecomputing.com).
      3. Set Warehouse to the Snowflake warehouse.
      4. (Optional) Set Account to your Snowflake account if your URL does not conform to the format above.
      5. (Optional) Set Database and Schema to restrict the tables and views exposed.

      See the Getting Started guide in the CData driver documentation for more information.

      Built-in Connection String Designer

      For assistance in constructing the JDBC URL, use the connection string designer built into the Snowflake JDBC Driver. Either double-click the JAR file or execute the jar file from the command-line.

      java -jar cdata.jdbc.snowflake.jar

      Fill in the connection properties and copy the connection string to the clipboard. A typical JDBC URL is below:

      jdbc:snowflake:User=Admin;Password=test123;Server=localhost;Database=Northwind;Warehouse=TestWarehouse;Account=Tester1;
  5. To view and modify a table, right-click a table and then click Edit Data -> Grid.

Using Snowflake Data with PowerBuilder Controls

You can use standard PowerBuilder objects to connect to JDBC data sources and execute queries. The following example shows how to retrieve Snowflake data into a DataWindow. You can add the following code to the open method:

SQLCA.DBMS = "JDBC" SQLCA.AutoCommit = False SQLCA.DBParm = "Driver='cdata.jdbc.snowflake.SnowflakeDriver',URL='jdbc:snowflake:User=Admin;Password=test123;Server=localhost;Database=Northwind;Warehouse=TestWarehouse;Account=Tester1;"; CONNECT USING SQLCA; dw_products.SetTransObject(SQLCA); dw_products.Retrieve();

Ready to get started?

Download a free trial of the Snowflake Driver to get started:

 Download Now

Learn more:

Snowflake Enterprise Data Warehouse Icon Snowflake JDBC Driver

Rapidly create and deploy powerful Java applications that integrate with Snowflake.