Troubleshoot SAP HANA data source issues
This document provides guidance for troubleshooting common issues when configuring and using the SAP HANA data source in Grafana.
Before you begin
Before investigating specific errors, verify that the data source health check passes:
- Go to Connections > Data sources and select your SAP HANA data source.
- Click Save & test.
- Confirm you see a success message.
If the health check fails, start with the Configuration errors or Connection errors sections.
Note
The Save & test validation doesn’t check access permissions to schemas. You may need to explicitly grant schema read permissions to the user.
Configuration errors
Configuration errors occur when required fields are missing or contain invalid values during data source setup.
Missing required fields
Port configuration issues
If you’re having trouble connecting, verify you’re using the correct port:
- SAP HANA Cloud: Typically uses port
443. - On-premises/tenant databases: Use the port determined by querying
M_SERVICES.
To find the correct port, run one of these queries:
From the tenant database:
SELECT SERVICE_NAME, PORT, SQL_PORT, (PORT + 2) HTTP_PORT
FROM SYS.M_SERVICES
WHERE ((SERVICE_NAME='indexserver' and COORDINATOR_TYPE='MASTER') or (SERVICE_NAME='xsengine'))From the system database:
SELECT DATABASE_NAME, SERVICE_NAME, PORT, SQL_PORT, (PORT + 2) HTTP_PORT
FROM SYS_DATABASES.M_SERVICES
WHERE DATABASE_NAME='<DBNAME>'
AND ((SERVICE_NAME='indexserver' and COORDINATOR_TYPE='MASTER') or (SERVICE_NAME='xsengine'))For detailed guidance, refer to the SAP HANA documentation.
Connection errors
Connection errors occur when Grafana cannot successfully communicate with the SAP HANA database.
Authentication failed
Symptoms:
- Save & test fails with authentication errors
- Error message indicates invalid credentials
Possible causes and solutions:
Connection refused or timeout
Symptoms:
- Data source test times out
- Error message indicates connection refused
- Intermittent connection issues
Solutions:
- Verify network connectivity from the Grafana server to the SAP HANA server.
- Check firewall rules allow outbound connections to the SAP HANA port.
- Verify the server address is correct and doesn’t include http/https prefixes.
- For private networks, ensure VPN or private connectivity is configured.
- For Grafana Cloud, configure Private data source connect if accessing private resources.
TLS verification failures
If you’re connecting to a SAP HANA instance with a self-signed certificate or a certificate signed by an internal CA:
- Enable Skip TLS Verify to bypass certificate validation (not recommended for production).
- Or, enable With CA Cert and provide your CA certificate in PEM format.
Query errors
Query errors occur when there are issues with the structure, syntax, or parameters of your SQL queries.
“No data” or empty results
Symptoms:
- Query executes without error but returns no data
- Charts show “No data” message
Possible causes and solutions:
Query timeout
Symptoms:
- Query runs for a long time then fails
- Error mentions timeout or query limits
Solutions:
- Narrow the time range to reduce data volume.
- Add WHERE clauses to filter the result set.
- Optimize the query with proper indexes.
- Use
$__timeGroupto aggregate data into larger intervals. - Break complex queries into smaller parts.
SQL syntax errors
Symptoms:
- Query fails with syntax error
- SAP HANA returns parser errors
Solutions:
- Verify table and column names are correctly quoted (SAP HANA is case-sensitive for quoted identifiers).
- Check that macros are being used correctly.
- Test the query directly in SAP HANA Studio or another SQL client.
- Ensure column names in SELECT match the case used in the database.
Macro expansion errors
Symptoms:
- Macros are not being replaced with values
- Unexpected SQL in the executed query
Solutions:
- Verify macro syntax is correct (e.g.,
$__timeFilter(column)not$_timeFilter(column)). - Check the Query Inspector to see how macros are being expanded.
- Ensure time columns are of the correct data type for the macro being used.
Template variable errors
These errors occur when using template variables with the data source.
Variables return no values
Solutions:
- Verify the data source connection is working (test it in the data source settings).
- Check that the variable query returns data.
- Verify the user has permissions to query the tables referenced in the variable query.
- Ensure the query returns the expected columns. For key/value pairs, use columns named
__textand__value, or return exactly 2 columns.
Variables are slow to load
Solutions:
- Set variable refresh to On dashboard load instead of On time range change.
- Add LIMIT clauses to variable queries.
- Optimize variable queries with indexes.
- Consider using static Custom variables instead of query variables.
Performance issues
These issues relate to slow queries or database load.
Slow query execution
Symptoms:
- Queries take a long time to return
- Dashboard panels load slowly
Solutions:
- Reduce the time range to limit the amount of data returned.
- Use
$__timeGroupto aggregate data into larger intervals. - Add indexes to frequently queried columns.
- Use LIMIT clauses to cap the number of returned rows.
- Avoid SELECT * and only request needed columns.
High database load from Grafana
Solutions:
- Increase the dashboard auto-refresh interval.
- Use query caching in Grafana Enterprise.
- Optimize queries to reduce database work.
- Limit the number of panels per dashboard.
Enable debug logging
To capture detailed error information for troubleshooting:
Update your Grafana configuration file (
grafana.ini):[log] level = debugRestart Grafana and reproduce the issue.
Review logs in
/var/log/grafana/grafana.log(or your configured log location).Look for SAP HANA-specific entries that include request and response details.
Reset the log level to
infoafter troubleshooting to avoid excessive log volume.
View executed queries
When a query fails, check the Query Inspector in Grafana:
- Open your dashboard panel.
- Click the panel title and select Inspect > Query.
- Review the executed query to verify macros expanded correctly.
Get additional help
If you continue to experience issues after following this troubleshooting guide:
- Check the Grafana community forums for similar issues.
- Review the SAP HANA documentation for database-specific guidance.
- Contact Grafana Support if you’re an Enterprise, Cloud Pro, or Cloud Contracted user.
- When reporting issues, include:
- Grafana version
- SAP HANA version
- Error messages (redact sensitive information)
- Steps to reproduce
- Relevant configuration (redact credentials)



