Structured Query Language (SQL) is used to manipulate and extract information from an SQL database.
In PowerMetrics, you can connect to data that's stored in an SQL database by executing an SQL query and retrieving information to create data feeds. Using those data feeds, you can visualize your data in custom metrics.
This article includes:
- Supported drivers
- Creating an SQL database data feed
- Next steps - Creating SQL database custom metrics
- Troubleshooting tips
The following JDBC drivers are supported:
- MS SQL (Microsoft SQL Server)
- Oracle Thin
- Oracle OCI
- Sybase SQL Anywhere
Note: ODBC drivers are not supported. Have you added our Klipfolio IP addresses to your allow list? See the full list of Klipfolio's Allow list IP addresses.
Creating an SQL database data feed
To create an SQL database data feed:
- Add a new data feed by clicking the + button beside Data Feeds in the left navigation bar. (See below.)
- Click Select data.
- On the Where is your data? page, under Core Data Services, click SQL query. (See below.)
- On the Configure data service page, fill in the following fields and select whether you want to Include column headers:
- SQL Query
- If accessing a database behind a firewall, click Use an SSH tunnel and type the required credentials.
- Click Get data.
- Ensure this is the data you're looking for, then click Continue.
- You're taken to the data feed editor, where you can make changes to the data feed or save it as-is.
If you want to modify the data feed, go to this article for detailed editing information.
- Give the data feed a name and, optionally, enter a description.
- Click Save data feed.
The data feed is added to your account and is ready to use for custom metrics. To see a list of all your data feeds, click Data Feeds in the left navigation sidebar.
Next steps - Creating SQL database custom metrics
Now that you've created one or more SQL database data feeds, you can return to them and use them to make custom metrics. A single data feed can be used to create a single or multiple custom metrics.
To create custom metrics using a data feed:
- In the left navigation sidebar, click Data Feeds to open your list of data feeds.
- Select the data feed you want to use for your custom metric.
- Click either the +Add metric button in the top right corner of the window or open the Metrics tab and click +Add metric. (See below.)
- Choose settings for your custom metric and click Save metric. If you need help, go here to learn more.
There are two options for querying an SQL database:
- Port forwarding to an external IP address
- Using an external SSH tunnel
If you followed the instructions above but still cannot connect to Klipfolio, consider the following:
- Have you added our Klipfolio IP addresses to your allow list? See the full list of Klipfolio's Allow list IP addresses.
- Is your database's external IP address publicly accessible and are you able to resolve the IP address to your database server? To test internally, ping or telnet your database's IP address. If unsuccessful, check your firewall configuration.
- For multiple instances of SQL server, check your SQL Server Configuration Manager to verify you have the correct port for the database to which you want to connect. The first SQL instance uses port 1433, other instances might use a different port number.
- Is the port open? Go to Port forwarding tester to test your port's status. If the port is not open, it might be a bad route or the destination SQL device might not be properly configured to listen to that port.
- For an SSH Tunnel, is the domain account valid?
- In Klipfolio, at the connect to an SQL database page, are you entering the IP address of the database server as the Host Name? Note: The Host field should not point to the SQL Server instance, just to the local host. For example, local host, not localhostSQLEXPRESS2012
- In Klipfolio, at the connect to an SQL database page, are you entering the actual database name at the Database field?
- Are you using an SQL Stored Procedure? When working with Klipfolio, you cannot use temporary tables or multi-selects in your Stored Procedure.