Error Scenario 1:
In this post, we will discuss about a few varieties of error message Unable to open a test connection to the given database and their resolutions.
Below is the error message for this communications link failure:
We will get the above error message, if we specify incorrect hostname: port values in property javax.jdo.option.ConnectionURL in hive-site.xml file.
In the above error message, we have given wrong hostname:port number combination (localhost:3308) in hive-site.xml.
We have to specify the correct hostname:port value in javax.jdo.option.ConnectionURL property value.
In local mode, we can specify this property with just localhost as hostname and port number as 3306 in distributed mode we can specify the actual hostname inplace of localhost. For local mode, it is shown below.
Note: Just by specifying the hostname without any port number will also resolves this issue. But if we are specifying the port number then we have to make sure that, we are giving correct port number.
Error Scenario 2:
Unable to open a test connection to the given database / Access denied for user ‘mysql_usr’@’localhost’ (using password: YES)
Below is the error message from console for this scenario: