In this article, we will explain how to resolve the “java.sql.SQLException: [Cloudera][ImpalaJDBCDriver]() Error initialized or created transport for authentication”
Traceback (most recent call last): File "/home//Transportation-Mangement/pyspark_script/script.py", line 75, in <module> finance.demo = spark.read.format("jdbc").option("url", jdbcURL).option("driver", "com.cloudera.impala.jdbc41.Driver").option("dbtable", env+"_finance.demo").load() File "/opt/cloudera/parcels/CDH-6.3.3-1.cdh/lib/spark/python/lib/pyspark.zip/pyspark/sql/rw.py", line 12, in load File "/opt/cloudera/parcels/CDH-6.3.3-1.cdh/lib/spark/python/lib/py4j-0.10.7-src.zip/py4j/java.py", line 1257, in __call__ File "/opt/cloudera/parcels/CDH-6.3.3-1.cdh/lib/spark/python/lib/pyspark.zip/pyspark/sql/utly.py", line 693, in deco File "/opt/cloudera/parcels/CDH-6.3.3-1.cdh/lib/spark/python/lib/py4j-0.10.7-src.zip/py4j/demo.py", line 9828, in get_return_value py4j.demo.Py4JJavaError: An error occurred while calling o79.load. : java.sql.SQLException: [Cloudera][ImpalaJDBCDriver]() Error initialized or created transport for authentication: [Cloudera][ImpalaJDBCDriver]() Authentication failed.. at com.cloudera.impala.hivecommon.api.HiveServer2ClientFactory.createTransport(Unknown Source)
The error belongs to authentication related, first we need to check the the Schema access for that particular user. If the user don’t have access then it will provide access for that particular DB. If the user have access but still getting the same error. Please follow the below steps:
Step 1 : Check the JDBC URL connection string, incase anything missed, need to provide proper connection string.
Step 2: If the JDBC connection string belongs to authentication string related. Please change Authmech value and SSL value like below
Step 3: If still getting the same error, user level access for the user in the specific groups and Cloudera and Impala service.
These type of issues belongs to Authentication/Permission related issues on specific Db/Schemas in the Impala, Hive services for Cloudera distributions in the Big Data environment.
Most of the cases occurred in the SQL/JDBC related only. So we need to simply fix with the above resolutions for user and db access from cluster level.
In Cloudera user needs to login once with the Cloudera manager web-ui and it reflects to cluster level. Then we can check from backend whether the user existing and what permission he/she have access on the particular DBs
Check Ranger policies for that user and if don’t have access please provide for specific schemas and provide read or write access to new user/ existing users.