Connecting to JDBC
This applies to: Managed Dashboards, Managed Reports
The JDBC generic data provider option lets you connect to data sources that have a JDBC driver. Since there are third-party drivers available for a wide range of databases and other data sources, this means that Symphony has the ability to connect to more data sources out-of-the-box than we can list. You can often use an existing JDBC driver rather than rely on a custom data provider.
Note: Only the 64-bit versions of the JDBC drivers are supported.
Here are some examples of data sources that have a JDBC driver:
Amazon Athena (Amazon S3)
Apache Phoenix
Hive
Impala
H2
Confluence
Note: insightsoftware does not guarantee any specific third-party JDBC driver will work properly with Symphony. If you encounter any connection issues with a specific driver, contact technical support.
Install
When you or your organization have your own Symphony installation, you can install whichever drivers you like on the computer(s) where Symphony is installed.
Symphony needs read access to the files.
Note: Services must be restarted after changing this setting or the files.
Connect
With a JDBC driver installed and configured, you can create a data connector in Symphony that uses the driver.
From the main menu, select New, and then select Data Connector.
In the New Data Connector dialog, set a Name, and then set Data Provider to JDBC.
Next, supply the required credentials:
Enter the JDBC URL. This will be different for every database and depends on the JDBC driver. For example, the JDBC URL for Amazon Athena is jdbc:awsathena://athena.us-east-1.amazonaws.com:443.
Enter the User Name for your database account.
Enter the Password for your database account.
If needed, click to expand the Advanced section to configure settings such as the following.
Driver Properties
Some connection properties cannot be included directly in the JDBC URL and have to be provided separately in the Driver Properties field. Similar to the URL, the list of properties and their format are different for each database and are typically documented by the JDBC driver provider.
For example, as documented by Amazon, the Amazon Athena JDBC driver can take parameters as part of the JDBC URL:
jdbc:awsathena://athena.us-west-1.amazonaws.com:443?max_error_retries=20&connection_timeout=20000
But also requires the s3_staging_dir to indicate a location to which the query output is written:
s3_staging_dir=s3://aws-athena-query-results-154861344432-us-east-1
Driver Class Name
Older JDBC drivers may require a Driver Class Name to enable the classes in the JAR file. For example, the main JDBC driver class for Amazon Athena is com.amazonaws.athena.jdbc.AthenaDriver
.
Use PrepareStatement
Certain non-JDBC compliant drivers may produce an error in certain cases, which can be avoided by unchecking the Use PrepareStatement advanced option.
Fetch Size
In some cases, setting a specific fetch size may help if too much data is loaded into memory at once resulting in an out of memory exception from the driver.
Clear Use Default Fetch Size and set a number (e.g., 10000 rows).
Date Trim Expression
Depending on certain conditions, some functionality such as time dimensions normally result in queries sent to the data provider that trim some portions of date/time values, for example to keep only the year portion of the original date. The syntax for this expression varies depending on the particular data source and JDBC driver you are using, so script written in DundasScript can be set for the Date Trim Expression setting. Without this expression, an error may occur for certain operations unless the data is stored in a data cube.
This script can access objects:
dateGranularity
(type: DateTimeGranularity) – The granularity or level to which the date should be trimmed.dataTypeName
(type: string) – The name of the column's data type, such asdatetime
ordate
, which may affect whether or not a value needs trimming.stringBuilder
(type: StringBuilder) – A string builder object instance that can optionally be used if needed.
The script should return a string representing a valid expression for the data source, including a placeholder {0}
that will be replaced by a column expression when included in a query.
The following is a sample date trim expression for a Trino JDBC driver:
{
dataTypeName = "datetime";
}
switch (dateGranularity)
{
case DateTimeGranularity.Minute:
if (dataTypeName.Equals("date", StringComparison.OrdinalIgnoreCase))
{
// No need to trim
return "{0}";
}
else
{
return "date_trunc('minute', {0})";
}
case DateTimeGranularity.Hour:
if (dataTypeName.Equals("date", StringComparison.OrdinalIgnoreCase))
{
// No need to trim
return "{0}";
}
else
{
return "date_trunc('hour', {0})";
}
case DateTimeGranularity.Day:
if (dataTypeName.Equals("datetime", StringComparison.OrdinalIgnoreCase))
{
return "date_trunc('day', {0})";
}
else if (dataTypeName.Equals("date", StringComparison.OrdinalIgnoreCase))
{
// No need to trim
return "{0}";
}
else
{
return "date({0})";
}
case DateTimeGranularity.Month:
return "date_trunc('month', {0})";
case DateTimeGranularity.Year:
return "date_trunc('year', {0})";
default:
return null;
}
return null;
Java VM Path
Some JDBC drivers require additional binary libraries.
To indicate the location of such libraries, select Admin from the main menu when logged in as an administrator, click to expand Setup and select Config to navigate to configuration settings.
Choose the option to show advanced settings, find the setting JVM Library Path and edit it to indicate the folder path.
For more information, see: