How to resolve the Unable to connect to database error

Symptoms

One or more SQL macros return the following error:

Error rendering macro 'sql-query' : Unable to connect to database using jdbc:mysql://<HOSTNAME>:<PORT>/<DBNAME> with user <USER>

Cause

SQL macro is referencing a data source profile that has one or more incorrect connection configurations. 

Resolution

Double check the connection information associated with this data source profile such as: Hostname, Port, Database, Username, and, Password