Home > database >  An error occurred while calling o107.load
An error occurred while calling o107.load

Time:10-19

I'm trying to connect to Teradata using the following code:

conf = SparkConf()
conf.set("spark.repl.local.jars", f"{jar_location}//terajdbc4.jar")
conf.set("spark.executor.extraClassPath", f"{jar_location}//terajdbc4.jar")
conf.set("spark.driver.extraClassPath", f"{jar_location}//terajdbc4.jar")

driver = 'com.teradata.jdbc.TeraDriver'
url = "jdbc:teradata://{0}".format(hostname)

spark = SparkSession.builder \
        .config(conf=conf) \
        .appName(appName) \
        .master(master) \
        .getOrCreate()

df = spark.read \
        .format('jdbc') \
        .option('driver', driver) \
        .option('url', url) \
        .option('query', "Select * from {0}.".format(database)   srcTable) \
        .option('user', username) \
        .option('password', password) \
        .load()
print(df)

I'm getting the following error :

py4j.protocol.Py4JJavaError: An error occurred while calling o107.load.
: java.sql.SQLException: [Teradata JDBC Driver] [TeraJDBC 17.10.00.27] 
[Error 1536] [SQLState HY000] 
Invalid connection parameter name url

What does this error mean? and how to resolve it?

CodePudding user response:

@Fred is correct. Do this:

url = "jdbc:teradata://{0}/STRICT_NAMES=OFF".format(hostname)
  • Related