VOOZH about

URL: https://www.cdata.com/kb/tech/mysql-odbc-qlikview-chart.rst

โ‡ฑ Connect to and Query MySQL Data in QlikView over ODBC


Connect to and Query MySQL Data in QlikView over ODBC

๐Ÿ‘ Jerod Johnson
Jerod Johnson
Director, Technology Evangelism
Create data visualizations with MySQL data in QlikView.

The CData ODBC drivers expand your ability to work with data from hundreds of data sources. QlikView is a business discovery platform that provides self-service BI for all business users in an organization. This article outlines simple steps to connect to MySQL data using the CData ODBC driver and create data visualizations in QlikView.

The CData ODBC drivers offer unmatched performance for interacting with live MySQL data in QlikView due to optimized data processing built into the driver. When you issue complex SQL queries from QlikView to MySQL, the driver pushes supported SQL operations, like filters and aggregations, directly to MySQL and utilizes the embedded SQL engine to process unsupported operations (often SQL functions and JOIN operations) client-side. With built-in dynamic metadata querying, you can visualize and analyze MySQL data using native QlikView data types.

Connect to MySQL as an ODBC Data Source

If you have not already, first specify connection properties in an ODBC DSN (data source name). This is the last step of the driver installation. You can use the Microsoft ODBC Data Source Administrator to create and configure ODBC DSNs.

The CData Provider supports connecting to on-premises and cloud-hosted versions of MySQL such as Amazon RDS for MySQL, Google Cloud SQL for MySQL, Azure Database for MySQL, or Oracle MySQL HeatWave. The Server and Port properties must be set to a MySQL server. If IntegratedSecurity is set to false, then User and Password must be set to valid user credentials. Optionally, Database can be set to connect to a specific database. If not set, tables from all databases will be returned.

SSH Connectivity for MySQL

You can use SSH (Secure Shell) to authenticate with MySQL, whether the instance is hosted on-premises or in supported cloud environments. SSH authentication ensures that access is encrypted (as compared to direct network connections).

SSH Connections to MySQL in Password Auth Mode

To connect to MySQL via SSH in Password Auth mode, set the following connection properties:

  • User: MySQL User name
  • Password: MySQL Password
  • Database: MySQL database name
  • Server: MySQL Server name
  • Port: MySQL port number like 3306
  • UserSSH: "true"
  • SSHAuthMode: "Password"
  • SSHPort: SSH Port number
  • SSHServer: SSH Server name
  • SSHUser: SSH User name
  • SSHPassword: SSH Password

SSH Connections to MySQL in Public Key Auth Mode

To connect to MySQL via SSH in Password Auth mode, set the following connection properties:

  • User: MySQL User name
  • Password: MySQL Password
  • Database: MySQL database name
  • Server: MySQL Server name
  • Port: MySQL port number like 3306
  • UserSSH: "true"
  • SSHAuthMode: "Public_Key"
  • SSHPort: SSH Port number
  • SSHServer: SSH Server name
  • SSHUser: SSH User name
  • SSHClientCret: the path for the public key certificate file

When you configure the DSN, you may also want to set the Max Rows connection property. This will limit the number of rows returned, which is especially helpful for improving performance when designing reports and visualizations.

Populate a Chart with MySQL Data

The steps below supply the results of an SQL query to a visualization in QlikView. In this article, you will create a bar chart with the query below:

SELECT ShipName, Freight FROM Orders
  1. Click File -> Edit Script (or click the Edit Script button in the Toolbar).
  2. On the Data tab, select ODBC in the Database menu and click Connect. ๐Ÿ‘ Connecting to an ODBC data source.
  3. Select the DSN (CData MySQL Sys) in the resulting dialog. ๐Ÿ‘ Selecting a DSN (Salesforce is shown).
    A command like the following is generated:
    ODBC CONNECT TO [CData MySQL Sys];
    
  4. Enter the SQL query directly into the script with the SQL command (or click Select to build the query in the SELECT statement wizard).
    SQL SELECT ShipName, Freight FROM Orders;
    

    Where possible, the SQL operations in the query, like filters and aggregations, will be pushed down to MySQL, while any unsupported operations (which can include SQL functions and JOIN operations) will be managed client-side by the CData SQL engine embedded in the driver.

    ๐Ÿ‘ A script that connects and executes an SQL query. (Salesforce is shown.)
  5. Close the script editor and reload the document to execute the script.
  6. Click Tools -> Quick Chart Wizard. In the wizard, select the chart type. This example uses a bar chart. When building the chart, you have access to the fields from MySQL, typed appropriately for QlikView, thanks to built-in dynamic metadata querying.
  7. When defining Dimensions, select ShipName in the First Dimension menu.
  8. When defining Expressions, click the summary function you want and select Freight in the menu.
  9. Finish the wizard to generate the chart. The CData ODBC Driver for MySQL connects to live MySQL data, so the chart can be refreshed to see real-time changes. Live connections are possible and effective, thanks to the high-performance data processing native to CData ODBC Drivers.

    ๐Ÿ‘ A chart populated with the results of a query. (Salesforce is shown.)

Ready to get started?

Download a free trial of the MySQL ODBC Driver to get started:

 Download Now

Learn more:

๐Ÿ‘ MySQL Icon
MySQL ODBC Driver

The MySQL ODBC Driver is a powerful tool that allows you to connect with live MySQL data, directly from any applications that support ODBC connectivity.

Access MySQL databases from virtually anywhere through a standard ODBC Driver interface.