Datasources are a type of PocketQuery Entity that defines where data should be fetched from. They can either be JDBC databases or REST APIs.
Security Advice
If your Datasource requires authentication, make sure to create a new user specifically for PocketQuery in that external service. Apply the principle of least privilege and make sure this user only has read access to data that you actually want to display with PocketQuery.
JDBC/SQL Datasource Types
JDBC/SQL Datasources use a JDBC driver to connect to a given Database. They typically require the following fields:
-
JDBC URL -
Username -
Password
Currently, the following types of JDBC/SQL Datasources are available:
|
Type |
JDBC URL Example |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Restricted JDBC properties: For security reasons, PocketQuery refuses JDBC URLs that set driver properties pointing to local files, Java classes, plugins, proxies or socket factories, for example sslfactory, sslcert, sslrootcert, authenticationPlugins, allowLoadLocalInfile, trustStore, private_key_file, OAuthPvtKeyPath or tnsAdmin. This also applies to settings inside other properties, such as search_path in options=-c search_path=…. Test connection and query runs then fail with Datasource validation error: Datasource url sets JDBC properties PocketQuery does not allow: …. Remove the listed properties from the URL. Oracle URLs starting with jdbc:oracle:thin:@config- are not supported.
REST Datasource Types
REST Datasources supports different kinds of authentication. For all REST Datasources a Base URL is required.
PocketQuery does not follow HTTP redirects (3xx). Use the final URL of your API as Base URL. REST hosts must resolve to public addresses: hosts that cannot be resolved, or that resolve to private, loopback, link-local or reserved addresses, are refused.
PocketQuery can also accept XML results from REST Datasources. If PocketQuery receives back an XML response from a Datasource, it will attempt to convert it into JSON before processing it further. For more information, enable Debug Mode in your PocketQuery macro.
REST Custom
Allows you to add custom HTTP Headers to your request which can be used for authentication. Also allows you to define custom URL parameters that will be added to every request.
Header and parameter values are stored like passwords: after saving, they are shown as empty fields with the placeholder Stored — leave empty to keep. Leave a field empty to keep its value. If you change the Base URL, Test URL or Authentication URL, you need to enter all stored header and parameter values again.
REST Basic
Just like with JDBC/SQL Datasources, this type of datasource lets you specify a Username and a Password. This will be encoded and put into in the Authorization for every request to this Datasource.
If you want to learn more about HTTP Basic Authentication, click here.
REST OAuth2
PocketQuery also supports OAuth2 token-based authentication. REST OAuth2 datasources can use the Refresh Token grant type (default) or the Client Credentials grant type. PocketQuery caches tokens and renews them automatically. Refer to the OAuth2 Datasource article to learn more about PocketQuery OAuth2 datasources.
If you are interested in resource limits related to Datasource, check out this article.